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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With