MedicalVisualization

3D Texture Objects

3D Texture Slice | | 3D Texture Data

A 3D texture has the size of w, h, und d (width, height, depth) voxels along the s, t und r texture coordinate axis. The corresponsing texture data values are stored linearily in memory, so that all column values of a row come first, followed by alle other rows of a single slice, then all slices of the volumes.

To upload a volume (or 3D texture) into graphics memory, we first create a so called texture object, which can contain the data of a single texture. The switch from one texture to another, is done by activating the corresponding texture object. The texture object acutally activated is said to be bound to the graphics hardware.

A new texture object is created with the OpenGL command glGenTextures(). Each texture object is assigned a unique texture id.

GLuint texid;
glGenTextures(1,&texid);

To bind a texture object to the graphics hardware we use the command glBindTexture() with the corresponding texture id as parameter:

glBindTexture(GL_TEXTURE_3D,texid);

Then all subsequent OpenGL calls that effect texture state (like glTexParameter and glTexImage) will change the state of the actually bound texture object.

Unbind the actual texture object:

glBindTexture(GL_TEXTURE_3D,0);

Delete a texture object:

glDeleteTextures(1,&texid);

After deletion of a texture object its occupied memory in main and graphics memory is released.

3D Texture Slice | | 3D Texture Data

Options: