View Full Version : How do I get the width and height of a texture
11-28-2009, 02:29 PM
How do i get the width and height of image I loaded as a texture? I used SOIL to load the image.
11-28-2009, 03:59 PM
The normal way is to "tell OpenGL the size of the texture", not the way round. This SOIL library seem too basic for your needs. Maybe hacking through its source code will provide you an API to ask for the texture size.
11-28-2009, 07:33 PM
I'll provide it with the size.
11-28-2009, 08:21 PM
int w, h;
int miplevel = 0;
glGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_WIDTH, &w);
glGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_HEIGHT, &h);
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.