Greetings,
I’m currently working on a prototype for a graphical Java application.
The application involves drawing high level elements like text, arbitrary shapes, but also drawing a high res deformed texture in the background.
After profiling and testing my conclusions are that for the high level elements Java2D would be excelent, it keeps up a good framerate and offers a stable api that does most of the work for you.
The only way to draw the distorted texture is in contrast tho a api which lets me draw textured triangle strips, which obviously points to JOGL (in fact it’s a round sonar display that has to map a rectangular texture in a circle, way cool Trying to do this in Java2D is tedious and slow and very pretty.
So I’m stuck now with the problem that I would like to use Java2D and JOGL in one and the same window. J2D for it’s high level API, JOGL for it’s fast textured triangle drawing.
I’ve tried to do this by drawing with J2D to a BuffereImage, and then using this image as a texture in JOGL.
This means having to copy the content of the image twice for each drawn frame tho (once from the byte[] array in the bufferedImage to a byteBuffer, and once when you call the jogl function to set up a texture) Which I’m affraid to say degrades the performance just a bit too much.
On a 1024*1024 BufferedImage I only get about 8 fps on my target platform, I’m aiming for 20
That’s with a BufferedImage set up in the same color model as opengl btw., so it’s straight copying without having to translate.
So my question is if someone has any ideas on:
- Speeding up the copying process I use.
- Other methods to intergrate J2D and JOGL that are might achieve a higher framerate
- Other ways to quickly draw textured triangles in J2D, using J2D primitives or other opengl bindings, or anything ^-^
- Intergrate JOGL and J2D the other way round, render opengl to a pbuffer and draw that in J2D? would be just as slow ? can’t be done platform independent yet ?
Any help would be greatly appreciated, I think this is a rather interesting topic for JOGL in general too, Being able to combine JOGL and J2D in such a fashion would be rather usefull
Since I’m building the thing now I’m mostly interested in solutions that can be done with the current JOGL btw. ^.^
Many thanks in advance!