Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: How to findout texture Dimensionality

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2005
    Posts
    3

    How to findout texture Dimensionality

    How can I programmaticaLly find out wether the texture is for example a TEXTURE_2D or TEXTURE_3D?

  2. #2
    Member Regular Contributor
    Join Date
    Jan 2004
    Posts
    322

    Re: How to findout texture Dimensionality

    What do you mean? Texture objects in graphics memory or before uploading?
    (not that I know the answer to either - but I'd say it depends on the person making the artwork)

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2005
    Posts
    3

    Re: How to findout texture Dimensionality

    I want something like glIsTexture2D or glIsTextureCube

    for example:
    void render (int name)
    {
    if (glIsTexture2D(name))
    printf("you are using 2d texture");
    if (glIsTexture3D(name))
    printf("you are using 3d texture");

    ...
    }

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,142

    Re: How to findout texture Dimensionality

    Afaik, there is only one possibility:
    Try to bind the texture, and check the error status...

    For example: glBindTexture(GL_TEXTURE_2D, texture) will give an INVALID_OPERATION error if "texture" is not actually a 2D texture object.

  5. #5
    Guest

    Re: How to findout texture Dimensionality

    For level 0

    glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, params);
    glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, params);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •