Java2D/JOGL/Fonts

Hi Ken,

You mentioned awhile back that you guys have
been working on integrating Java2D and JOGL.
I also remember that Java2D glyphs are rasterised
and cached in the OpenGL pipeline under certain
conditions.

My JOGL application requires high quality typographical
effects so I’m wondering if there are plans to
provide access to these glyph caches so that
I can save a lot of code and memory. Are there
heuristics or mechanisms to control Java2D’s
caching of glyphs so that one may decide to
turn it off to save memory, especially when rolling
their own custom glyph caches.

I think these are one of the few hurdles left to
enable really powerful graphical applications
in Java.

.rex

No. However, you will (shortly) be able to use the Graphics2D object directly to draw Java2D fonts directly over the result of JOGL rendering using the GLJPanel. Actually you can already do this (if you’re using the JSR-231 sources which allow subclassing the GLJPanel and overriding of paintComponent) but it will soon be much faster.

Unfortunately I need to do 3D and
shader-related stuff on the glyph
textures so Graphics2D doesn’t meet
the needs. Does that mean I’ll have
to roll my own glyph caches?

Regarding GLJPanel getting faster,
does this mean there won’t be a
p-buffer nor glReadPixels() or any
kind of extra copying going on?
Thanks…

.rex

I think so. You may be able to use Java2D to get a BufferedImage per character. Try posting on the Java2D forum on javadesktop.org.

[quote]Regarding GLJPanel getting faster,
does this mean there won’t be a
p-buffer nor glReadPixels() or any
kind of extra copying going on?
[/quote]
That’s correct. More details Real Soon Now.

Awesome… These are things that make my nipples quiver with excitement… ;D

You can use the Java2D glyph rendering system to render to a buffered image that you then use as a texture.

This system is used in Xith3D (look in the recent thread about Text2D implementation or in the latest release for another implementation) and can very easily be adapted to be used whithout Xith3D (the scenegraph part isn’t really used for that).

Vincent