texture dimensions from texture handle

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.


What kind of image do you load ?
You could get the dimensions by there. :slight_smile:

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.

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 :smiley:
(but then I remembered, there are no stupid questions… only stupid people :p)

Specifically the problem is the following statement in the framebuffer extension:

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.