#### Archived

This topic is now archived and is closed to further replies.

# 3d texture with mipmap

## Recommended Posts

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??

##### Share on other sites
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.

##### Share on other sites
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

##### Share on other sites
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.

##### Share on other sites
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

• ### Forum Statistics

• Total Topics
628401
• Total Posts
2982457

• 9
• 10
• 9
• 19
• 24