• Advertisement
Sign in to follow this  

Strange Texture mapping problem

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

As you can see texture is not mapped corectly, why? Im using this code for 2d mode:
w = 640;
h = 480;
	Gl.glTexCoord2f(0.0f, 1.0f); Gl.glVertex2f(0, 0);
	Gl.glTexCoord2f(0.0f, 0.0f); Gl.glVertex2f(0, h);
	Gl.glTexCoord2f(1.0f, 0.0f); Gl.glVertex2f(w, h);
	Gl.glTexCoord2f(1.0f, 1.0f); Gl.glVertex2f(w, 0);





Share this post


Link to post
Share on other sites
Advertisement
I don't exactly see what's wrong (it's a spinning cube right?), but most probably the texturing coordinates have been flipped. So you coule try:

Gl.glTexCoord2f(0.0f, 0.0f); Gl.glVertex2f(0, 0);
Gl.glTexCoord2f(0.0f, 1.0f); Gl.glVertex2f(0, h);
Gl.glTexCoord2f(1.0f, 1.0f); Gl.glVertex2f(w, h);
Gl.glTexCoord2f(1.0f, 0.0f); Gl.glVertex2f(w, 0);

Share this post


Link to post
Share on other sites
The problem is that image should look like this:
Image Hosted by ImageShack.us

Maybe the problem is in texture loading code?

Share this post


Link to post
Share on other sites
It's probably the loading code, but check to make sure it's not the actual texture. Many a coder has been tricked by trying to debug working code when the data is borked. [razz]

Share this post


Link to post
Share on other sites
Ha ha, just found a problem!

I forgot to parse picture. I just loaded it with all header & other pixels directly to GL.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement