Advertisement

rotating sprites

Started by November 03, 2018 08:32 PM
9 comments, last by RoamBlade 6 years, 3 months ago

YEAH!!! I solved my problem by putting a glTranslatef in my code .

Advertisement

float r = sqrt(pow(0.5f, 2) + pow(0.5f, 2));

glBegin(GL_POLYGON);
glTexCoord3f(0.0f, 0.0f, 0.0f);

glVertex3f(0.0625f+cos(angle)*r*up+horizontal, 0.0625f+sin(angle)*r*up+vertical, 0.0f);
glTexCoord3f(1.0f, 0.0f, 0.0f);

glVertex3f(-0.0625f+cos(angle)*r*up+horizontal, 0.0625f+sin(angle)*r*up+vertical, 0.0f);
glTexCoord3f(1.0f, 1.0f, 0.0f);

glVertex3f(-0.0625f+cos(angle)*r*up+horizontal, -0.0625f+sin(angle)*r*up+vertical, 0.0f);
glTexCoord3f(0.0f, 1.0f, 0.0f);

glVertex3f(0.0625f+cos(angle)*r*up+horizontal, -0.0625f+sin(angle)*r*up+vertical, 0.0f);
glEnd();

so, my OpenGl is limited, but are you pushing already rotated and translated vertices? as opposed to sending a quad and applying a proper translation*rotation matrix?

 

This topic is closed to new replies.

Advertisement