Reputation: 619
I'm getting a GL_INVALID_VALUE error after calling glTexImage2D()
GLCheckForErrors(); // no error
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, width, height, 0, GL_RED, GL_UNSIGNED_BYTE, 0);
GLCheckForErrors(); // error printed here
I've substituted the values of width and height to 512 and 512 respectively and it solves my issue. This leads me to believe It's a power-of-two issue. But what I don't understand is i thought there was NPOT textures available with the opengl version I'm using?
OpenGL Version - 4.1 INTEL-8.28.30
GLSL Version - 4.10
Renderer - Intel HD Graphics 5000 OpenGL Engine
This should support NPOT textures fine right?
Thanks
Upvotes: 1
Views: 5024
Reputation: 619
My width parameter was too large it seems (over 24,000).
I was loading a series of characters in one long texture so all I did was remove the unnecessary characters to bring the width down and I'm no longer getting that error.
Another solution would be to just have a fixed width and then build up (but this was not going to be that easy for me due to each character having a variable width).
The relevant error condition from the glTexImage2D() man page is:
GL_INVALID_VALUE is generated if width or height is less than 0 or greater than GL_MAX_TEXTURE_SIZE.
The limit for the texture size can be queried with glGetIntegerv(GL_MAX_TEXTURE_SIZE, ...)
.
Upvotes: 2