Jump to content
  • Advertisement
Sign in to follow this  
tomsh

rotate

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

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);

Share this post


Link to post
Share on other sites
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)

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!