Results 1 to 3 of 3

Thread: OpenGL: Determining size of a loaded texture

  1. #1
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    OpenGL: Determining size of a loaded texture

    I'm using OpenGL and I'm trying to figure out how to query the width and height of an already loaded texture. Is this possible after I've already loaded it into memory?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #2

    OpenGL: Determining size of a loaded texture

    Assuming you've already created the texture, then the following code will return the width of the currently bound texture (height, same method just change one parameter):

    [pascal]var
    iWidth: Integer;
    begin
    //.....
    glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, @iWidth);
    Writeln('Width = ', iWidth);
    //.....
    end;[/pascal]
    [size=10px]"In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it's the exact opposite." -- Paul Dirac[/size]

  3. #3
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    OpenGL: Determining size of a loaded texture

    Excellent! Thanks this is what I needed.
    Jason McMillen
    Pascal Game Development
    Co-Founder





Bookmarks

Posting Permissions

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