PDA

View Full Version : Texture 3D to Image..



Rikez
08-09-2007, 02:13 AM
Hi...

Im not very expert OpenGl developper but my problem isn't not trivial...and not for beginners too..
:D
I'm developping a Multi-Planar Reconstruction for medical application and I'm a texture 3D that I cut with some quads for display different sections (Images 2D) translating plans..

Now, I would get back Images 2D diaplayed on the quads, in a buffer...but I don't have Ideas what... :confused:

Do you have???

thank you very much

Good Time

Zengar
08-09-2007, 03:45 AM
So basically you want to extract a 2D image layer from a 3D texture, is this correct? In such case, you can just draw a quad, textured with the appropiate texture layer and get the array of pixels using the ReadPixels function. I am not sure how this is an advanced question though...

ZbuffeR
08-09-2007, 04:55 AM
I you don't need the results back on the CPU, simply use glTexSubImage (http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copytexsubimage2d.html) to copy a portion of screen to texture (faster).

EDIT: more precise.

Rikez
08-09-2007, 08:18 AM
In fact i draw a quad but in my viewer ther are a lot of object and i would recover back onli the 2D cut and not all the screen

ZbuffeR
08-09-2007, 12:22 PM
Yes of course.
Please read the link I posted.

Rikez
08-10-2007, 02:41 AM
In fact I would like get back the interpolted images in the seme qualities and size of original images source of texture

ZbuffeR
08-10-2007, 05:21 AM
What prevents you from rendering your 2D quad (with appropriate scale to match texture size) on screen, then copy to tex, then clear (no swap) then do the real classic rendering ?

I am not sure if you are advanced enough, but another possibility is to render to a FBO (http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt) .
http://www.gpgpu.org/w/index.php/Code_Examples#OpenGL_FBO_example

Search the web for other tutorials on opengl FBO.

Rikez
08-13-2007, 01:13 AM
thanks I 'll try with the FBO....

but with this object, can I get back the interpolated images? the parameter zoffset is int....

thank you very much..

HI..

Rikez
08-14-2007, 06:33 AM
I'm ssorry, another question..

can i with the FBO recover back all t possible cut image (In every direction) of texture 3D???

thanks

Zengar
08-14-2007, 11:16 AM
I don't really understand... Just render the part of the 3d texture on a fullscreen quad, either using FBO or without it (doesn't matter anyway). Then read or copy it. Like this (without vbo):



glClear(...)
bind 3d texture
render a quad
readback
repeat as much you want
glClear(...)
render the scene
SwapBuffers()