PDA

View Full Version : OpenGL: Determining size of a loaded texture



WILL
25-10-2006, 06:58 AM
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?

cragwolf
25-10-2006, 07:42 AM
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):

var
iWidth: Integer;
begin
//.....
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, @iWidth);
Writeln('Width = ', iWidth);
//.....
end;

WILL
25-10-2006, 08:59 AM
Excellent! Thanks this is what I needed. ;)