Skip to main content
GameDev.net gamedev.net
🔒 Locked

Strange Texture mapping problem

Started by LuckyOne Dec 3, 2005 at 2:23 PM 3 replies 800+ views
Original Post
LuckyOne
LuckyOne
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);





deavik
deavik
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);
LuckyOne
LuckyOne
The problem is that image should look like this:
Image Hosted by ImageShack.us

Maybe the problem is in texture loading code?
Mercury
Mercury
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]
LuckyOne
LuckyOne
Ha ha, just found a problem!

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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.