PDA

View Full Version : texture dimensions from texture handle



Mikkel Gjoel
10-31-2009, 11:10 AM
Is it possible to get the dimensions of a texture, having only the texture-id? (handle, object...)

The reason why I need this, is because I can only access the texture-handle from an FBO, not the texture target (GL_TEXTURE_2D etc). It just returns GL_TEXTURE or GL_RENDERBUFFER etc. So maybe I'm missing something there.

Thanks

DarkShadow44
10-31-2009, 11:50 AM
What kind of image do you load ?
You could get the dimensions by there. :)

zeoverlord
10-31-2009, 03:11 PM
So maybe I'm missing something there.
Thanks

Yea one thing, you don't have to get something you already have, just save away the dimensions or whatever data you need when you load/create the texture or when you otherwise tell openGL what it does, and there you go.

Mikkel Gjoel
10-31-2009, 06:52 PM
Thanks for the replies. zeaoverlord - yea, doing that already. This is for debugging to see if everything is setup as it should be. Problem only arises if I am checking FBO-attachments - I can check that it's a texture using GetFramebufferAttachmentParameter... but not which kind (texture2d, rectangle etc.).

Horribly embarrassed even asking about this :D
(but then I remembered, there are no stupid questions... only stupid people :p)

Mikkel Gjoel
11-02-2009, 02:48 AM
Specifically the problem is the following statement in the framebuffer extension (http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt):

If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE at a particular attachment point is TEXTURE, the sizes may be determined by calling GetTexParameter, as described in section 6.1.3.
Section 6.1.3 uses GetTexParameter which requires a target (tex2d/rect...) that doesn't seem obtainable from an FBO alone. It does seem the intention was to make texture-state for fbo queryable using regular texture functions.