View Full Version : steps for rendering a volume using 3D textures
11-23-2003, 05:51 PM
One step in rendering a volume using 3D textures is to Compute a series of polygons that cut through the data perpendicular to the direction of view. Then Use texture coordinate generation to texture the slice properly with respect to the 3D texture data.Is any functions available in OpenGL to complete these tasks,or should i handle that in C code first?
It should be easy enough to compute the vertices of the polygons first in C. There's nothing in OpenGL that will help with this.
Use the OpenGL functions GlTexGen* to automatically generate texture coordinates based on the dimensions of your 3D texture, taking into account any scaling.
Once you've done that, you need to retrieve the modelview matrix (with glGet*) and obtain it's inverse. Then during rendering of the geometry, transform the texture matrix by the inverse of the modelview matrix. That will ensure that the texture coordinates are correct from your point of view.
Hope this helps.....
I have a free executable volume rendering application available on my web site if you want to take a look. The link is http://www.rmrsystems.co.uk/volume_rendering.htm
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.