Hiya guys and a Happy New Year to all of you.
I am trying to do a particle system to represent snow and rain. At the moment i am concentrating on the snow and using a snow flake texture mapped to a quad. The problem is I am trying to use billboarding so the quad is constantly facing the viewer. At certain points the quad faces the viewer and at others it doesnt.
I am trying to draw the quad with two points remaining the same and the outer points rotating as the view does.
glPushMatrix();
float rotX, rotY;
rotX = cos(yaw*PI/180);
rotY = sin(yaw*PI/180);
glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex3f(tempX+rotX,tempY-1,tempZ+rotY);
glTexCoord2f(1,0);
glVertex3f(tempX-rotX,tempY-1,tempZ-rotY);
glTexCoord2f(1,1);
glVertex3f(tempX-rotX,tempY+1,tempZ-rotY);
glTexCoord2f(0,1);
glVertex3f(tempX+rotX,tempY+1,tempZ+rotY);
glEnd();
glPopMatrix();
particles[i]->setX(tempX-wind.x);
particles[i]->setY(tempY-gravity-wind.y);
particles[i]->setZ(tempZ-wind.z);
if(particles[i]->getY() < 0)
particles[i]->kill();
where yaw is the angle i rotate the eye around the y-axis.
When rotating my eye i use a combination of rotation and translations.
glRotatef( -pitch, 1.0, 0.0, 0.0 );
glRotatef( -yaw, 0.0, 1.0, 0.0 );
glTranslatef( -eyeX, -eyeY, -eyeZ );
If ne1 could help me i would really appreciate it. If ne more info is needed please just say and ill provide what i can.
Thanx
Tom