TextRenderer - very low FPS with dynamic text

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

TextRenderer - very low FPS with dynamic text

asambol
I'm using the new TextRenderer (from com.jogamp.graph.curve package) to display 20 labels on the screen, together with my model (which runs normally at 60 FPS). The text should update on every draw. However, it is very slow - about 0-2 FPS. If I change it to draw non-dynamic Strings, it works fine, at 60 FPS.

Here's how I initialize it:
	        ShaderState shaderState = new ShaderState();
	        RenderState renderState = RenderState.createRenderState( shaderState, SVertex.factory() );
	        textRenderer = TextRenderer.create(renderState, 0);
	        textRenderer.init(gl);
	        textRenderer.setColorStatic( gl, 1.0f, 1.0f, 1.0f );
	        textRenderer.setAlpha( gl, 1.0f );

And here's the part of my draw method which draws random text:

	        gl.glUseProgram(textRenderer.getShaderState().shaderProgram().program()); // equivalent to st.glUseProgram(false)
	        for (int i=0; i<20; i++) {
	            textRenderer.resetModelview( null );
	            textRenderer.translate( null, -0.6f, -0.38f+0.03f*i, -1.0f );
	            textRenderer.scale(gl, .02f, .02f, 1.0f);
	            textRenderer.drawString3D(gl, font, String.format("%02.0f fps - %06.5f - %d", animator.getLastFPS(), Math.random(), i), position, fontSize, textureSize );
	            textRenderer.flushCache(gl);
	        }

When I remove the random number it works much better, although every time FPS changes (DEFAULT_FRAMES_PER_INTERVAL) it stutters and then continues normally until the next FPS change.

CPU consumption:
without labels: ~50%
with labels: ~100%
- only 1 core, other cores are mostly at ~10%

Memory consumption (javaw.exe process):
without labels: 181 MB
with labels: varies between 712 MB and 780 MB

Any advices?
Reply | Threaded
Open this post in threaded view
|

Re: TextRenderer - very low FPS with dynamic text

Rami Santina
Administrator
Hi,
The init of the text into GLRegion is kindof slow  and needs revisiting/enhancement -> true

what you can do now is either init all your text on init and save the GLRegion in map and using the regionRenderer render when needed (rendering is realtime)
Thats why only in dynamic this is showing.

check attached snapshot of a sample from my app using the text, able to render and type in realtime!
so the non realtime is weird, can you elaborate on the setup?



On Fri, Jan 18, 2013 at 12:31 PM, asambol [via jogamp] <[hidden email]> wrote:
I'm using the new TextRenderer (from com.jogamp.graph.curve package) to display 20 labels on the screen, together with my model (which runs normally at 60 FPS). The text should update on every draw. However, it is very slow - about 0-2 FPS. If I change it to draw non-dynamic Strings, it works fine, at 60 FPS.

Here's how I initialize it:
	        ShaderState shaderState = new ShaderState();
	        RenderState renderState = RenderState.createRenderState( shaderState, SVertex.factory() );
	        textRenderer = TextRenderer.create(renderState, 0);
	        textRenderer.init(gl);
	        textRenderer.setColorStatic( gl, 1.0f, 1.0f, 1.0f );
	        textRenderer.setAlpha( gl, 1.0f );

And here's the part of my draw method which draws random text:

	        gl.glUseProgram(textRenderer.getShaderState().shaderProgram().program()); // equivalent to st.glUseProgram(false)
	        for (int i=0; i<20; i++) {
	            textRenderer.resetModelview( null );
	            textRenderer.translate( null, -0.6f, -0.38f+0.03f*i, -1.0f );
	            textRenderer.scale(gl, .02f, .02f, 1.0f);
	            textRenderer.drawString3D(gl, font, String.format("%02.0f fps - %06.5f - %d", animator.getLastFPS(), Math.random(), i), position, fontSize, textureSize );
	            textRenderer.flushCache(gl);
	        }

When I remove the random number it works much better, although every time FPS changes (DEFAULT_FRAMES_PER_INTERVAL) it stutters and then continues normally until the next FPS change.

CPU consumption:
without labels: ~50%
with labels: ~100%
- only 1 core, other cores are mostly at ~10%

Memory consumption (javaw.exe process):
without labels: 181 MB
with labels: varies between 712 MB and 780 MB

Any advices?


If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/TextRenderer-very-low-FPS-with-dynamic-text-tp4027924.html
To start a new topic under jogl, email [hidden email]
To unsubscribe from jogamp, click here.
NAML


sample.png (640K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: TextRenderer - very low FPS with dynamic text

asambol
To be specific, we're developing an instrument cluster. I have attached a simple screenshot where you can see how many labels I got. These labels are rendered by our own renderer, which we would like to replace with something like Jogamp TextRenderer for greater flexibility and performance.

Instrument Cluster

That's why I tried creating 20 labels using Jogamp TextRenderer containing FPS + another Math.random() value and it proved to be incredibly slow.

I can't prerender all possible text values to a map because I don't know what values I will have to draw - it will be based on sensor or simulator output.


Rami Santina wrote
Hi,
The init of the text into GLRegion is kindof slow  and needs
revisiting/enhancement -> true

what you can do now is either init all your text on init and save the
GLRegion in map and using the regionRenderer render when needed (rendering
is realtime)
Thats why only in dynamic this is showing.

check attached snapshot of a sample from my app using the text, able to
render and type in realtime!
so the non realtime is weird, can you elaborate on the setup?