texture bit depth query

Am I just being an idiot, or why do I get zero?


GLint red_bits=0,green_bits=0,blue_bits=0,alpha_bits=0;



(R300, Cat3.6)

Oh yeah, I should add that the texture renders as expected. That has never been a problem.

[This message has been edited by zeckensack (edited 07-20-2003).]

Reading through the spec quickly, I can’t see GL_TEXTURE_*_SIZE as a valid parameter to glGetTexParameter. And when I try your code, glGetError returns GL_INVALID_ENUM after the first glGetTexParameter.

And you get zero because you initialize your variables to zero, and glGetTexParameter does not modify them because of the error. Change them and you will get another result

Thanks Bob

Oh joy … I’ve found it.

In case anyone’s interested in the solution, it’s


Seems somewhat illogical to me. Can a texture have different internal formats per mipmap level? I don’t think so …

Ho hum.

[This message has been edited by zeckensack (edited 07-20-2003).]

Well, since you must upload each mipmap level separately, then maybe you CAN specify different internal formats for each level. If so, then it makes sense to use glGetTexLevelParameter. Just tried and it reported no errors at least (tried it in a debugger only, no visual tests to see if it actually renders correct, I do that when I got more time).

Gee, you really do learn something every day, even basic stuff when you’ve known OpenGL for several years.

OpenGL 1.4 spec, section 3.8.10 : Texture completeness

A texture is said to be complete if all the image arrays and texture parameters required to utilize the texture for texture application is consistently defined. The definition of completeness varies depending on the texture dimensionality.
For one-, two-, or three-dimensional textures, a texture is complete if the following conditions all hold true:
The set of mipmap arrays levelbase through q (where q is defined in the
Mipmapping discussion of section 3.8.8) were each specified with the same internal format.

Effects of Completeness on Texture Application
If one-, two-, or three-dimensional texturing (but not cube map texturing) is enabled for a texture unit at the time a primitive is rasterized, if TEXTURE MIN FILTER is one that requires a mipmap, and if the texture image bound to the enabled texture target is not complete, then it is as if texture mapping were disabled for that texture unit.