Create texture directly from volatileImage

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

Create texture directly from volatileImage

Pepe1
Hi,

I'm creating a java implantation of http://alteredqualia.com/visualization/evolve/, as a hobby project. I'm using HW-accelerated Graphics2D to draw the polygons on a volatile image, I then want to create a texture from the volatileImage so I can use glReadPixels to compare the generated image to the original (which is also a texture).

I spent the last 2 hours spitting through various Textures documentations, but there doesn't seem to an easy way to create a texture out of a volatileImage. Did I miss something here, or is this just not possible? I know you can convert the volatileImage to a BufferedImage and then create the Texture, but this method is very slow. Which is a bad thing considering performance is crucial for this program.
Reply | Threaded
Open this post in threaded view
|

Re: Create texture directly from volatileImage

gouessej
Administrator
Hi

Why do you use VolatileImage? Is VolatileImage.getSnapshot() slow?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Create texture directly from volatileImage

Pepe1
Yeah, VolatileImages can make use of hardware acceleration, BufferedImages can not.
Reply | Threaded
Open this post in threaded view
|

Re: Create texture directly from volatileImage

gouessej
Administrator
Durandal's answer is satisfying. There is no public API to access the data stored into a volatile image and using BufferedImage by setting the acceleration property allows to obtain the same effect. However, keep in mind that there are several calls that can cause your image to stop being hardware accelerated. If you just want to display the result in your graphical user interface, rather use a JOGL canvas and draw a single rectangle in it.
Julien Gouesse | Personal blog | Website