Sign in to follow this  
Grain

Retrieving Texture Parameters

Recommended Posts

I just know there has to be a function for this. Lets say I create a texture through
m_Images[2].Load("LazerShot10.tga");
	glGenTextures(1, &TextHandels[2]);
	glBindTexture(GL_TEXTURE_2D, TextHandels[2]);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_Images[2].GetWidth(), m_Images[2].GetHeight(),
				 0, GL_RGBA, GL_UNSIGNED_BYTE, m_Images[2.GetImage());
What do I do if at some later time I want to find out what the width and height are.

Share this post


Link to post
Share on other sites
Quote:
Original post by zedzeek

GetTexLevelParameteriv( GL_TEXTURE_2D, level, GL_TEXTURE_WIDTH, ..
Am I to assume I have to bind the texture I am interested in first?

Share this post


Link to post
Share on other sites
glGetTexLevelParameter() will get the parameters of the currently uploaded texture in the current active texture unit. So, yes, if your texture is not bound, you will have to bind it first. Personally, I prefer to keep this kind of information off-line (not in the GL) and query my own structures for this stuff.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this