com.jogamp.graph.curve.opengl.TextRenderer without shader?

classic Classic list List threaded Threaded
8 messages Options
aqd
Reply | Threaded
Open this post in threaded view
|

com.jogamp.graph.curve.opengl.TextRenderer without shader?

aqd
Hello jogl devs!

I'm trying to replace old TextRenderer with the curve one in WorldWind's SurfaceText, which renders text for each shape onto a tile texture and then apply the texture to virtual globe. The problem is that if I don't turn off shader, the rendering ignores current matrix (set for each shape inside the tile texture) and draws all text to the center of tile texture instead of the center of each shape.

What does the shader do? If it has to be turned on, how can I fix the matrix?
Reply | Threaded
Open this post in threaded view
|

Re: com.jogamp.graph.curve.opengl.TextRenderer without shader?

gouessej
Administrator
The new text renderer is fine and fast but do you absolutely need to get rid of the "old" TextRenderer?

The new text renderer can't be used without shaders, that's why I don't use it.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: com.jogamp.graph.curve.opengl.TextRenderer without shader?

Sven Gothel
Administrator
In reply to this post by aqd
On 08/02/2014 03:48 PM, aqd [via jogamp] wrote:
> Hello jogl devs!
>
> I'm trying to replace old TextRenderer with the curve one in WorldWind's
> SurfaceText, which renders text for each shape onto a tile texture and then
> apply the texture to virtual globe. The problem is that if I don't turn off
> shader, the rendering ignores current matrix (set for each shape inside the
> tile texture) and draws all text to the center of tile texture instead of the
> center of each shape.

Sorry, I cannot follow you.

>
> What does the shader do? If it has to be turned on, how can I fix the matrix?

The new graph shader ?

Depending on the mode,
it either renders curves directly into the framebuffer,
or utilizes some AA, e.g. renders into a 'bigger' FBO for VBAA (view based AA)
or using MSAA (not so good quality).

I assume you refer to a fixed point matrix you have via WW
and like to apply this to our graph renderer ?

In this case, you need to pass it explicitly, since graph uses
core OpenGL (ES2) only and manages it's own PMV matrix.

However, we have examples like MovieSimple, MovieCube etc,
which share a PMV matrix instance.

Best would be to analyze our current graph text renderer unit tests,
IMHO things should become more clear:
 com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT10
   - Simple demo using TextRegionUtil

 com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube
   - Demo using TextRendererGLELBase
     within MovieCube's InfoTextRendererGLELBase

   - Sharing the PMV matrix

TextRendererGLELBase simply incorporates
TextRegionUtil and a RegionRenderer within an GLEventListener
while exposing some convenient state full text output like line counting.

TextRendererGLELBase may end up in a public API, currently it's in
the unit test (demo) space.

~Sven



signature.asc (894 bytes) Download Attachment
aqd
Reply | Threaded
Open this post in threaded view
|

Re: com.jogamp.graph.curve.opengl.TextRenderer without shader?

aqd
This post was updated on .
Thanks! I just fixed the positioning of text with shader.

But the renderer seems to have bad support with CJK fonts at smaller size. Here is the result with Microsoft JHengHei, the default Windows font since Windows Vista:


(some holes in glyph are unexpectedly filled)

It looks the same with or without shader applied, but the problem disappears when the text become larger.
Reply | Threaded
Open this post in threaded view
|

Re: com.jogamp.graph.curve.opengl.TextRenderer without shader?

Sven Gothel
Administrator
On 08/03/2014 09:31 AM, aqd [via jogamp] wrote:
> Thanks! I just fixed the positioning of text with shader.

Great.

>
> But the renderer seems to have bad support with CJK fonts. Here is the result
> with Microsoft JHengHei, the default Windows font since Windows Vista:
>
>
> (some holes in glyph are unexpectedly filled)

Besides the bugs, looks great.

Yes, we have a few issues here.

My guess is either our triangulation code [1]
or our TTF parsing [2].

We also have this issue w/ some serif fonts.

[2]: I have validated our OutlineShape create from TTF glyphs
     w/ specs and other implementations and it seems to be fine.

[1]: The CDTriangulator2D, 'Constrained Delaunay Triangulation',
     may be of an issue here ?!

Surely we need to identify the root cause and fix this.

I hope Rami will join this effort as well,
if he is able to allocate the time.
The latter is quite difficult though .. busy.

If anybody likes to join analysis of this bug
and is capable (math, ..) and has the time,
your help is of course very much appreciated!

Cheers, Sven



signature.asc (894 bytes) Download Attachment
aqd
Reply | Threaded
Open this post in threaded view
|

Re: com.jogamp.graph.curve.opengl.TextRenderer without shader?

aqd
Sorry I was wrong. It failed with Chinese no matter the size, or the font.

I have tested:

Adobe Fan Heiti Std B
Arial Unicode MS
Droid Sans Fallback (Android's font)
Microsoft JHengHei
Microsoft YaHei
MingLiU



Droid Sans looks nearly perfect and its holes seem only filled because the stroke is far too wide. I set the weight property but nothing changes.



I still had to get AWT TextRenderer back for now. Somehow it gets very slow even with the latest CPU (i7-4700MQ) and GPU (GTX 860m) of mine. Rendering hundreds of chinese names is enough to completely freeze my World Wind for more than a second. However, I workaround the problem by pre-rendering text in another thread (to AWT backing store, Java2D is the only thing that's slow).

I assume you people won't further improve the AWT renderer, right? So I don't need to bother with source compatibility?
Reply | Threaded
Open this post in threaded view
|

Re: com.jogamp.graph.curve.opengl.TextRenderer without shader?

Sven Gothel
Administrator
On 08/05/2014 04:48 PM, aqd [via jogamp] wrote:

> Sorry I was wrong. It failed Chinese fonts no matter the size, or the font.
>
> I have tested:
>
> Adobe Fan Heiti Std B
> Arial Unicode MS
> Droid Sans Fallback (Android's font)
> Microsoft JHengHei
> Microsoft YaHei
> MingLiU
>
>
>
> Droid Sans looks nearly perfect and its holes seem only filled because the
> stroke is far too wide. I set the weight property but nothing changes.
Thx for the details.

>
>
>
> I still had to get AWT TextRenderer back for now.

> Somehow it gets very slow
> even with the latest CPU (i7-4700MQ) and GPU (GTX 860m) of mine. Rendering
> hundreds of chinese names is enough to completely freeze my World Wind for
> more than a second.

With our 'AWT text renderer' or w/ our 'Graph text renderer' ?

In graph, we cache the glyph data incl. tesselation and shader attributes.
Hence rendering shall be only limited to the GPU/GLSL performance
after this 'graph data initialization'.

> However, I workaround the problem by pre-rendering text in
> another thread (to AWT backing store, Java2D is the only thing that's slow).
>
> I assume you people won't further improve the AWT renderer, right? So I don't
> need to bother with source compatibility?

If you like to jump in and maintain the AWT text renderer,
you would be welcome of course.

API incompatibility changes will be allowed in each minor version update,
see wiki version-semantics.
Of course, they should be reasonable, however,
removing deprecated stuff and avoiding duplicate code is always reasonable.

There is also one branch 'floating around' using GL3 w/ AWT renderer,
which has not been merged for around 2 years now since the author
didn't maintain it anymore.
  <https://github.com/adbrown85/jogl>

+++

As mentioned earlier,
helping in improving graph text rendering is always welcome as well,
if not even favored :)

~Sven



signature.asc (894 bytes) Download Attachment
aqd
Reply | Threaded
Open this post in threaded view
|

Re: com.jogamp.graph.curve.opengl.TextRenderer without shader?

aqd
This post was updated on .
The slowness is with AWT renderer of course. But no more problem now since I pre-render all text in separated thread and give the cache texture max size (16384x16384) per each TextRenderer.

The curve renderer is very fast at rendering the same numbers of text (first-time rendering). I also made it to work without shader successfully: the matrix/position/scale are all fine, and color has to be set via glColor4fv instead of TextRenderer.setColorStatic, and GL_BLEND has to be enabled for translucency to take effect.



PS: I'm more interested in getting curve TextRenderer to work with chinese fonts, or porting AWT renderer to SWT or something faster. But right now I only have time for fast & ugly hacks to make everything looking smooth and acceptable....