Jump to content
  • Advertisement
Sign in to follow this  
Grain

Retrieving Texture Parameters

This topic is 5037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!