Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
This post was updated on Feb 17, 2016; 8:56am.
I'm trying to use new TextRegionUtil to render a simple text to screen. I'm using GL3 on Mac OS X, so I cannot use GL2 backward compatibility and old TextRenderer, that work very well.
This is what I do: Font font; int[] sampleCount; int renderModes; RenderState renderState; RegionRenderer renderer; TextRegionUtil textRegionUtil; renderModes = Region.DEFAULT_TWO_PASS_TEXTURE_UNIT; renderState = RenderState.createRenderState(SVertex.factory()); renderer = RegionRenderer.create(renderState, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); textRegionUtil = new TextRegionUtil(renderModes); Font font = FontFactory.get(new File("fonts/ApexNew-Book.ttf")); sampleCount = new int[] { 10 }; During init: renderer.init(gl, renderModes); renderer.enable(gl, false); I change color with: renderState.setColorStatic(r, g, b, a); I set the ortho with: renderer.reshapeOrtho(width, height, near, far); And I print the text with: int fontSize = 20; int dpiH = 96; float pixelSize = font.getPixelSize(fontSize, dpiH); PMVMatrix pmv = renderer.getMatrix(); pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmv.glPushMatrix(); pmv.glTranslatef(x, y, z); renderer.enable(gl, true); textRegionUtil.drawString3D(gl, renderer, font, pixelSize, text, null, sampleCount); renderer.enable(gl, false); pmv.glPopMatrix(); My text is rendered on the screen but is very bad, like not antialiased. As the same happens with other fonts. Any suggestion to make the font "beautiful"? Thanks in advance |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi,
can we see a screenshot? You may want to consider to enable multisampling |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi,
here you can see the screenshot: https://drive.google.com/file/d/0B682ScIfEmFYTTJyaHFOLXBQZEE/view |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Multisample can help every where except the on "8" and the "d" of "bad"..
God, they are really rendered bad, something seems totally broken on those two.. are they fine in the .ttf? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In the .ttf are ok, here you can see it:
https://drive.google.com/file/d/0B682ScIfEmFYS1FmS3hONTZrRWs/view Same font is rendered well with the old TextRenderer. For enable multisample you just mean: gl.glEnable(GL3.GL_MULTISAMPLE); because if so the result is not getting better. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
It's not enough, you also need to render to a multisample texture, like here
Anyway, then something is definitely wrong in TextRegionUtil |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Ok, so I need to render to FBO with multisample texture each time I print a text.... not so comfortable.
I think I'll post a bug about this because I need print text with GL3. Thanks |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Yeah, but anyway multisample is not gonna help you with the "8" and the "d", it helps only for aliased borders |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
There is another possibility to print text with GL3 rather than use TextRegionUtil? Someone didn't convert old TextRenderer class?
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Sorry but I am not expert on that, Gouessej can help you here, he will reply you soon
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I see that there is a pull request to add OpenGL 3 support to TextRenderer:
https://github.com/sgothel/jogl/pull/47 While I'm waiting for Gouessej reply I download that branch, maybe it will use it. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
In reply to this post by paolofuse
There is a pull request containing some code to use the "old" text renderer with GL3.
Oops, you have already found it...
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi Julien,
finally I tried the "old" text renderer with GL3 but I had to fix some bugs: - the use of VAO was forced, I have made it working with setUseVertexArrays method of TextRenderer - the setColor method set wrong color, using Green component also for Blue - calling beginRendering for the first time with a not white (1, 1, 1, 1) color threw an exception, I have created a init() method to call before start rendering With these changes TextRenderer works perfectly. Thanks |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Hi
Please can you mention your fixes in the pull request so that we don't forget your findings? Thank you for the feedback.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |