textrenderer suggestion

hello,

i think there are currently two problems with the jogl textrenderer. yes, in both cases it is not the textrenderers fault but actually a problem of the driver of the specific graphics card, however the jogl textrenderer fails.

the one is that the use of vertexArrays actually slows down render performance significantly.
http://www.java-gaming.org/forums/index.php?topic=18033.0
http://www.java-gaming.org/forums/index.php?topic=17665.0

the other is that the use of vertexBufferObjects results in an exception (glBindBuffer not available) because the graphics card driver incorrectly reports OpenGL 2.0 to be available.
http://www.java-gaming.org/forums/index.php?topic=17833.0
http://www.java-gaming.org/forums/index.php?topic=17892.0

i would suggest that both features can be switched on/off via the API. either through an additioncal constructor or with functions like:

public void useVertexArrays(true/false);
public void useVertexBufferObjects(true/false);

what do you think?
thank you.

Sounds reasonable, but what about a system property like -Djogl.TextRenderer.nova or .novbo? This will avoid polluting the public API, but I could see it not being an effective solution in all cases.

Hi,

I agree with Ken, I would be better to avoid making the API more complex to solve driver problems.

thank you!

yes, system property would be ok, too.

however with the API, we could switch between the solutions at runtime, for example via a settings dialog.

I’ve filed Issue 339 to track this. I am completely swamped right now so if you can provide a patch which you have tested that would be very helpful.

thank you,

here is a modified version of the TextRenderer, where the issues are solved via the API.
http://www.embege.com/misc/TextRenderer.java

there are basically three changes, which i have also commented in the code:

  1. vertexArrays are switched off by default. you can enable them with public void setUseVertexArrays(boolean useVertexArrays)

  2. a try-catch block has been added around the call to glBindBuffer in the endDrawing() function. if an exception occurs it automatically falls back to as if isExtensionAvailable(“GL_VERSION_1_5”) returns false.

  3. the call to isExtensionAvailable from the endRendering() function has been moved into an if-block, so that it is not called all the time, but only once. otherwise this would make point 2. senseless :smiley:

if this class is of any help to you guys, please feel free to use it.

Thanks for the suggested patch. I’ve attached it to Issue 339 and will consider it, but I would prefer to avoid any public API changes for this purpose.

thanks.

yeah, i agree that polluting the API is not nice. but i think this only affects the second issue (glBindBuffer). the first issue (vertex arrays slow) is actually depending on the situation for which the text render is used and so it should be made available to the user wether to render with VAs or not.

Thanks again for your patch. I’ve incorporated a slightly modified version which will show up in tomorrow’s nightly build as well as the forthcoming 1.1.1-rc7, which should be out tomorrow.

thanks a lot for the update! i am looking forward to RC7.

can you give a little more details on what exactly the patch you have checked in, does? thanks!

It’s almost exactly what you posted except for a small refactoring. set/getUseVertexArrays() are now exposed. Check out the javadoc.

If I may suggest an issue for TextRenderer: If it is possible to add the option of changing the font of a renderer, instead of creating a new TextRenderer object if i want to use another font.

I hope you consider this!

Feel free to file an RFE about this using the JOGL Issue Tracker.

I also like to have the same functionnality. I added it on the Issue tracker (issue 348).