Programming > OpenGL
Element exceeds maximum supported number of combined texture image units
(1/1)
Danjb:
Hello,
I have just set up a debug message callback, and I'm seeing lots of these errors:
--- Code: ---[LWJGL] OpenGL debug message
ID: 0x501
Source: API
Type: ERROR
Severity: HIGH
Message: GL_INVALID_VALUE error generated. Element exceeds maximum supported number of combined texture image units.
--- End code ---
I have only created 6 textures, and I am only binding 1 at a time. When I print the value of glGetInteger(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS) I get 192, so I don't understand what limit I am hitting here.
Can anyone please offer some insight?
Thanks,
Dan
KaiHH:
The first step is to identify, which GL call caused this error. If you are using LWJGL 3, then the easiest way is to start your JVM with the LWJGLX/debug agent: https://github.com/LWJGLX/debug
You can download it directly from here: https://build.lwjgl.org/addons/lwjglx-debug/lwjglx-debug-1.0.0.jar
Then start the JVM with the JVM argument -javaagent:/path/to/lwjglx-debug-1.0.0.jar and you should see a stack trace when you hit the error.
Danjb:
Thank you so much, that was really helpful.
The problem was that I was doing this:
--- Code: ---glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureId);
glUniform1i(uniformLoc, GL_TEXTURE0);
--- End code ---
Instead of this:
--- Code: ---glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureId);
glUniform1i(uniformLoc, 0);
--- End code ---
GL_TEXTURE0 has the value 33984, whereas samplers have to have a value in the value [0, GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS).
(Source: https://www.khronos.org/opengl/wiki/Texture#Samplers)
Thanks again.
Dan
Navigation
[0] Message Index
Go to full version