Reputation: 23477
I am playing around with some old OpenGL code and I am having some issues with this...
glGetTexParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &glW);
glGetTexParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &glH);
Now I am new to OpenGL but I am guessing this grabs the height and width of the texture. The problem is, OpenGLES doesn't have GL_TEXTURE_WIDTH or HEIGHT. Now I know that the first answer everyone is going to give is "you need to manage this yourself", however, this is a pretty large code base and it would take some serious time to figure this out.
My question is...
How can I get the width/height of a texture in OpenGLES?
Upvotes: 4
Views: 5484
Reputation: 100612
Obvious reaction question: why do you need this information?
Obvious question aside, texture size is not directly exposed. The best you're probably going to be able to do is to use glTexSubImage
checking for GL_INVALID_VALUE
to search for the size — my reading of the GLES man page is that width = height = 0 isn't an error condition so you can hunt for the greatest (x,y) that's accepted without actually uploading any data.
Upvotes: 3