How do I get the width and height of a texture

How do i get the width and height of image I loaded as a texture? I used SOIL to load the image.

Thanks,

~justin123

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.

I’ll provide it with the size.

Thanks

int w, h;
int miplevel = 0;
glGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_WIDTH, &w);
glGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_HEIGHT, &h);