enabling more than 4 texture units on gffx without error

im wanting to have access to more than 4 textures on my gffx 66.00 with glsl but im getting a invalid_operation error

int error_code = glGetError(); no error
glActiveTexture( GL_TEXTURE4 );
error_code = glGetError(); no error
glEnable( GL_TEXTURE_2D );
error_code = glGetError(); <- INVALID OPERATION

this shouldnt be happening (or should it) according to the spec this should be ok, so whats up?

– opengl spec –
If the texture image unit number corresponding to the current value of
ACTIVE TEXTURE is greater than or equal to the implementation-dependent constant
MAX COMBINED TEXTURE IMAGE UNITS, the error INVALID OPERATION is
generated by any such command.

gffx MAX COMBINED TEXTURE IMAGE UNITS = 16

cheers zed

I don’t know about the spec, but since you can only access more than four texture units by using fragment programming, and fragment programs ignore the enable state of the texture unit, there should be no problem with simply leaving the texture units disabled.

Originally posted by OneSadCookie:
I don’t know about the spec, but since you can only access more than four texture units by using fragment programming, and fragment programs ignore the enable state of the texture unit, there should be no problem with simply leaving the texture units disabled.
uhm im not completely sure, but i think the texture units have to be enabled correctly even if fragment programs are used (no idea why since the access type is specified in the fp, but still i really think the glEnable(GL_TEXTURE_XD) has to be called. btw i think ati was a bit lenient with their implementation and it worked even without the enable for quite some time)

as for the question… hmmm this should really work. have you tried querying the state of the texture unit if other texture targets are already enabled?

Confirmation from the specs that texture unit enables are ignored:

for GLSL, see here:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_shader.txt
(issue number 9; search the page for “OpenGL provides a hierarchy”)

for ARB_fragment_program, see here:
http://oss.sgi.com/projects/ogl-sample/registry/ARB/fragment_program.txt
(issue number 15; search the page for “OpenGL provides a hierarchy”)

thanks onesadcookie (i see youre in the capital, at the moment im near nelson), ive just come online to write ive discoved it myself in the spec., now to go back to trying to figure out why my benchmark app seems to be telling me im rendering 1 billion tris/second!


3.11.2 Shader Execution
If a fragment shader is active, the executable version of the fragment shader is used
to process incoming fragment values that are the result of point, line segment, polygon,
pixel rectangle or bitmap rasterization rather than the fixed-function fragment
processing described in sections 3.8 through 3.10. In particular,
• Texture application as described in section 3.8.15 is not applied.

3.8.15 Texture Application
Texturing is enabled or disabled using the generic Enable and Disable commands,
respectively, with the symbolic constants