Advertisement Jump to content
Sign in to follow this  
Shai

texture loading

This topic is 4913 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 feel like an idiot for asking this, but here goes. Why does this work?
                glGenTextures(1, &Texture);
		glBindTexture(GL_TEXTURE_2D, Texture);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, 256,256,GL_RGB,GL_UNSIGNED_BYTE, image);
		glBindTexture(GL_TEXTURE_2D, Texture);
But this doesn't?
                glGenTextures(1, &Texture);
		glBindTexture(GL_TEXTURE_2D, Texture);
		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_RGB, 255, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
		glBindTexture(GL_TEXTURE_2D, Texture);
The first one displays the texture, the second one doesn't. Am I forgetting something?

Share this post


Link to post
Share on other sites
Advertisement
Probably because in the second example the image isn't power of 2 glTexImage2D won't work if the image isn't power of two. In the other example the size of the image shouldn't really matter because it'll resize it to be power of two I believe. I don't see why it wouldn't work aside from that though... Ah and don't forget to enable GL_TEXTURE_2D, stupid but it happens =)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
dont think it will make a difference, but I found using RGB8 instead of RGB should be more compatible for some reason in the texturebuild options

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!