View Full Version : Using GL_TEXTURE_BASE_LEVEL with a comple texture

12-10-2008, 09:53 PM

I have an OpenGL mipmap texture that is complete. By that, I mean all mipmap levels have been properly loaded with glCompressedTexImage2DARB. Now, I can set the texture to use only the mipmap level starting at level 1 with this function:


This is working fine with my geforce 8800. However, with my Radeon HD 4670 I get a black polygon instead of a polygon textured with mipmap level 1. I have been looking for why my radeon behave this way. I wonder if someone has seen a similar problem and maybe knows about a solution.


12-11-2008, 05:52 AM
Yup, this has come up before. Some tricks to try in this thread...

http://www.opengl.org/discussion_boards/...true#Post249035 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Board=3&Number=249035&Searchpage=1&Main=46884&Words=glGenerateMipmap&topic=0&Search=true#Post249035)

though I can't seem to get anything to work (HD4650/08.11).

12-11-2008, 06:58 AM
In my case I am not using automatic mipmap generation. I set every mipmap manually one after the other. If i decide not to fill up mipmap 0 and fill up all the other mips, then setting GL_TEXTURE_BASE_LEVEL to 1 works. I can see mipmap 1 on my polygon. This proves that mipmap 1 is well loaded in the texture. I can check all the other mipmap the same way.
I have to add that I am not using trilinear filtering and my texture sampling mode is set to GL_NEAREST.
I still don't understand why then It does not work when all mipmaps have been loaded and I use GL_TEXTURE_BASE_LEVEL to offset the first mip level. :(

12-11-2008, 03:30 PM
This is maybe a driver bug. For example, on intel graphic card, when loading mipmap level manually I have to do it for all levels even if I know that the last ones won't be used. Otherwise I got a white uniform color whereas it works fine on nvidia hardware. I know that my example is not a good practice, this was just to illustrate

12-11-2008, 05:43 PM
If this is a driver bug it is really unfortunate! I have everything working on nvidia and I wasn't expecting mip-mapping to be a problem on radeon... I will keep investigating to see if there is a workaround.

12-11-2008, 05:59 PM
Yup, this has come up before. Some tricks to try in this thread...

http://www.opengl.org/discussion_boards/...true#Post249035 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Board=3&Number=249035&Searchpage=1&Main=46884&Words=glGenerateMipmap&topic=0&Search=true#Post249035)

though I can't seem to get anything to work (HD4650/08.11).

We have to glEnable(GL_TEXTURE_2D) before glGenerateMipmapEXT?
Is that garanteed to work on all of ati's drivers?

Ilian Dinev
12-11-2008, 10:51 PM
There are two more things to try: GL_EXT_texture_lod_bias and GL_TEXTURE_MAX_LOD

12-12-2008, 08:09 AM
According to the OpenGL spec.

"3.8.10 Texture Completeness ...
Array levels k where k < LEVELbase or k > q are insignificant to the definition of completeness."

Your test demonstrates the contents of a level less than LEVELbase affects the result. The driver has a bug.

Have you tried erasing the contents of level 0 by setting its size to 0 by 0?

12-12-2008, 09:24 AM
Thanks for all your inputs!

I have some new findings. I made a simple program to move a textured front facing quad along the z axis so I can see the transition in mipmap level has they occur (Min filter set to LINEAR_MIPMAP_LINEAR).

My texture is a 256x256 DXT1, and all the levels are filled up with data. In addition, I made sure to put distinctive colors in the levels so I can really the mips. I am using glCompressedTexImage2DARB and the texture data comes from a pixel buffer object (glBufferData...).

With my Radeon 4670, I noticed that the first level of the texture is loaded and appears fine. But I get black in all the other levels. I can see the fist mip blend into black as my quad moves away.

It was when I decided to load the textures mip levels without using the PBO that I started getting something. All the mip levels loaded fine and I could see them transition on my quad as I move it.

Going to my original post, now changing the value for GL_TEXTURE_BASE_LEVEL works fine on my Radeon.
So it seems my problem was with the pixel buffer object. The first mip level loads fine but all the other don't. However, I know that it works fine on my geforce.
I wonder if there is something special about loading textures through pbo on radeon...

12-13-2008, 06:37 AM
Not using PBOs, but was able to reproduce the bug.

Setting TEXTURE_BASE_LEVEL without also setting TEXTURE_MAX_LEVEL seems to result in sampling from the last level, regardless of default implementation values. And sampling from certain narrow ranges of levels, say [L, L + 1], can result in a crash. However if sampling is confined to exactly 1 level (BASE==MAX) things appear to be in working order.

This with all levels of a 1024x1024 2D DXT1 texture specified with glCompressedTexImage2D.

12-13-2008, 03:43 PM
Just gave it a go on the recently released Cat 8.12 with the same results (Vista32 SP1).

I submitted a bug report over here


12-13-2008, 04:01 PM
As for me I am on Vista64. So it's a driver bug then. For now, I will avoid using PBO to load textures on my radeon... :(