Sign in to follow this  

texture loading

This topic is 4516 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
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

This topic is 4516 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.

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