rotate

Started by
0 comments, last by Sik_the_hedgehog 12 years, 3 months ago
when I rotate the player it draws tree black lines:
rotatex.png


When I don't rotate the player, he doesn't have this lines...

This the rotate code:
if(ySpeed != 0 || xSpeed != 0)
deg = fmod(atan2(yP-(yP+ySpeed),xP-(xP+xSpeed))/3.14159265f*180.f,360.f);
glPushAttrib(GL_TRANSFORM_BIT);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glPushMatrix();
glTranslatef(0.5f, 0.5f, 0.f);
glRotatef(deg, 0.f, 0.f, 1.f);
glTranslatef(-0.5f,-0.5f, 0.f);
glMatrixMode(GL_MODELVIEW);
glPopAttrib();


glEnable (GL_BLEND);
glColor4f(1.0f,1.0f,1.0f,1.0f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glBegin(GL_QUADS); //draw...
glTexCoord2d(1.0,1.0);glVertex3f( xP, yP2, 0);
glTexCoord2d(0.0,1.0);glVertex3f( xP2, yP2, 0);
glTexCoord2d(0.0,0.0);glVertex3f( xP2, yP, 0);
glTexCoord2d(1.0,0.0);glVertex3f( xP, yP, 0);
glEnd();


glMatrixMode(GL_TEXTURE);
glPopMatrix();

glMatrixMode(GL_MODELVIEW); glDisable (GL_BLEND);
Advertisement
It's trying to render what's beyond the texture. Because the wrapping mode is "clamp", it'll extend what's in the borders (if it was "repeat", you'd get tiling instead).

Why are you rotating the texture instead of the polygon?

EDIT: just noticed I replied to a more than one week old post >_>' (well, still not very old)
Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

This topic is closed to new replies.

Advertisement