Skip to main content

OffScreen Texture

2 replies [Last post]
scidocks
Offline
Joined: 2003-06-12
Points: 0

I'm currently working on a module for dynamic texture advection - continuous alpha blending of current image in framebuffer with noise textures. I'm using an OffScreenCanvas3D to capture the screen image and find the memory blips to be quite insignificant but the FPS to be not so good.

For screen capture, what's the difference between using an OffScreenCanvas3D and using a Raster in normal Canvas3D to achieve the same purpose ? With the Raster I can get the z-buffer values too it appears, but that aside is there any other difference in efficiency ?

I tried grep-ing the native source to find instances of glCopyTexSubImage use, but couldn't find any except for those in glext.h. Isn't that gl function more efficient than glReadPixels for screen capture (atleast according an nVidia article !) ? If so, any chance of exposing it if it ain't there already.

TIA

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
scidocks
Offline
Joined: 2003-06-12
Points: 0

Some further observations on the above:

1. Using an OffScreenCanvas3D for continuous screen capture appears to keep the gc busy (it also appears that such is not the case with Raster).

2. It appears that the ImageComponent2D and BufferedImage obtained from getOffScreenBuffer() and getOffScreenBuffer.getImage() are the ones which were actually sent in as input thru' setOffScreenBuffer(..) with ALLOW_IMAGE_READ/WRITE capabilities on the ImageComponent2D buffer. IOW, it appears that gc activity cannot possibly be due to continuous newing of the obove objects. The question then is whether Java 3D is internally allocating any new memory.

3. Assuming that there is potential gc activity as in (2), could that be the reason why an OffScreenCanvas3D is slower than a Raster ? Unfortunately the Raster has some disadvantages that precludes its use for my purpose.

Any help will be appreciated.

scidocks
Offline
Joined: 2003-06-12
Points: 0

OK ! managed to get rid off the gc problems with OffScreen approach. FWIW, here are some stats for a simple test case that I'm experimenting with:

OffScreenCanvas3D: 3 FPS
Raster: 15 FPS
OGL+GLUT(uses glCopyTexSubImage): 50-60 FPS

Is it really possible that glCopyTexSubImage can make such an impact ?