I’m currently working on a QT program that uses OpenGL to display a 3D volume rendering of a brain. There are some minor display bugs which I need to fix but have hit a wall simply on how the 3D texture of the brain is being displayed.
No binding nor explicit tex coord assignment is occuring. Yet the image displays nearly perfectly. Here’s the short code snippet.
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_3D);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
#ifdef _WIN32
myGLTexImage3D;
#endif
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
texture_width, texture_height, texture_depth,
0,
GL_RGBA, GL_UNSIGNED_BYTE, texture_data);
glBegin(GL_QUADS);
for(int i = 0; i < slices; i++)
{
glVertex3f(-windowHalf, -windowHalf, -windowHalf + i * offR);
glVertex3f( windowHalf, -windowHalf, -windowHalf + i * offR);
glVertex3f( windowHalf, windowHalf, -windowHalf + i * offR);
glVertex3f(-windowHalf, windowHalf, -windowHalf + i * offR);
}
glEnd();
glDisable(GL_TEXTURE_3D_EXT);
glDisable(GL_BLEND);
Aside from the normal initializing code, thats it. All my attempts to actually bind the texture and specifically assign texture coordinates yield a solid block of white. I didn’t even know it was possible to display textures without binding. The above code is being called on every redisplay. Probably not the best idea. My questions are; without explicitly binding the texture, what’s happening? Is it being loaded directly into the fame buffer to draw? Second, what’s the default text coordinate assignment OpenGL gives when nothing is explicitly stated? Finally, anyone have any clue why that white block appears when I try to bind it?