TextRenderer questions

hello, i got some questions about the textrenderer.

  1. what are the font-texture’s parameters? minfilter? maxfilter? is it mipmapped? is it possible to change them?

  2. there seems to be a small glitch with text appearing from other lines. it’s only a few pixels on the baseline shining through.
    here is a screenshot, you can see some unwanted pixels below the S and leftbelow the o.

http://www.embege.com/misc/font.png

and one more question not about the textrenderer itself:

does anyone know how to add a clipboard event listener to the glcanvas? i want to be able to paste text into it. thanks.

As far as i know:

[quote]1. what are the font-texture’s parameters? minfilter? maxfilter? is it mipmapped? is it possible to change them?
[/quote]
minfilter is how the texture will look when its scaled down, i.e further away from you. You usually pick GL_LINEAR or something like that for this, so when it has to decide whats the best color for the pixels as its no longer its original size it uses linear interpolation i think.

maxfilter is pretty much the opposite of minfilter, so when you scale up or its closer to you, it will interpolate the pixels in whatever method you give it.

mipmapped is used when using LoD, so if you have the image up front it will have to be quite detailed, meaning it will take up alot of memory. However if its further away its not going to be as detailed so you can cheat and use mip mapping to make less detailed versions the further you go away. You will notice this in most games these days, if you look at the floor and notice how detailed it is, then look in the distance and you should be able to see a cut off point where the texture becoems less detailed, and less and less until its just like a brown blur or something really far away…

Im not that experienced with fonts, so i cant really answer any other questions but the above answers apply to textures generically regardless of if they are fonts/particles/model textures.

It uses GL_LINEAR for both the min and max filters, not mipmapped. Since the TextRenderer is designed for one-to-one correspondence with texels and screen pixels, I don’t think mipmapping is needed. Let me know if you think otherwise. Note that the TextRenderer basically delegates to the TextureRenderer class which supports rendering into an OpenGL texture using Java 2D.

Are you using the latest JOGL nightly build? We added a little “slop” around the text rendering results to avoid this consequence of using GL_LINEAR filtering. See TextRenderer.normalize(). Please either file a bug with a test case or play around with the numbers in the normalize() routine and submit a patch.

This page came up from a quick Google search.

grofit, thanks for the explanation, but my question was not meant like “what is minfilter/maxfilter” but more like “which minfilter/maxfilter is used”. sorry, i guess the question was badly formulated.

thanks Ken.

  1. well to decide if mipmapping is needed or not, i’d like to see the difference first. i make use of the draw3D functionality a lot. would it be possible to add a function like getFontTexture() to the textrenderer that returns the Texture-object. then we could set textureparameters ourselves.

  2. these glitches were seen using RC3. i will give the current nightlies a try.

  3. thanks, but reading and writing from the clipboard is not my problem. the problem is to catch the event when someone presses ctrl+v/c/x on the glcanvas window.

It isn’t that simple because the underlying Texture may be destroyed and re-created basically at any time. I want to avoid making the TextRenderer’s API excessively complicated. If you can suggest simple enhancements to the API (look at the TextureRenderer for examples, like setSmoothing(true), or the Texture API, like setTexParameteri()) please file an RFE. It would be even better if you could contribute some code.

Adding a KeyListener to the GLCanvas should capture these events.

  1. well for mipmapping i suggest an additional boolean operator in the constructor of the TextRenderer

  2. yes, these glitches dont seem to occur in the current nightlies anymore. thanks!

  3. thanks, but it seems that this KeyEvent.VK_PASTE is never triggered. i read that it is exclusive to keyboards that have extra keys for cut,copy,paste… (yeah, those exist).

Please file an RFE using the JOGL Issue Tracker.

You should be getting at least some key event for these key presses. Probably VK_C plus the Control modifier. One way or another you should be able to detect the event and handle it properly.