3d texture with mipmap

Started by
3 comments, last by Henri 21 years, 2 months ago
I’m trying to use some 3d textures in my engine, and I have everything setup correctly except that I can’t get the mipmaps to work. Here is the code:
  
glGenTextures(1, &textureHub[0]);
glBindTexture(GL_TEXTURE_3D, textureHub[0]);
glTexParameteri(GL_TEXTURE_3D,GL_TEXTURE_MAG_FILTER,GL_LINEAR );
glTexParameteri(GL_TEXTURE_3D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
	
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 64 , 64, 4, 0, GL_RGB, GL_UNSIGNED_BYTE, image3.imageData);
glTexImage3D(GL_TEXTURE_3D, 1, GL_RGB, 32 , 32, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, image4.imageData);
glTexImage3D(GL_TEXTURE_3D, 2, GL_RGB, 16 , 16, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, image5.imageData);
  
I don’t understand why this wont work, all I get is a white area where the texture should be. And all of the maps work if I disable mipmaps and run on of them as a level 0 map. BTW Am I supposed to decrease the depth of the texture as I''m doing, and when "hitting" 1 at depth, then stop? I''m currently only using 4 textures, but that should be about 8 or 16 future on... Any ideas??
Advertisement
The trexture size must go all the way down to 1x1x1. So you''re missing the mipmap levels with size 8x8x1, 4x4x1, 2x2x1 and 1x1x1.
thats correct, though i have a feeling not all cards support mipmaps with 3d textures look into it

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
quote:Original post by zedzeek
thats correct, though i have a feeling not all cards support mipmaps with 3d textures look into it

They must. The OpenGL 1.2 standard, as well as the EXT_texture3D extension, specifically require the support of 3D mipmaps. Of course, implementations are free to fall back to software mode, if HW support is not given.
youre correct Yann i was getting confused with texture_recetange (ie non power of 2 textures) which u cant do mipmapping with

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

This topic is closed to new replies.

Advertisement