Adding in multiple characters
I am trying to add code to display a second character, the x,y,z,yrot will be passed for the other computer through the server and will send mine to that computer through the server aswell. My problem is how do I draw the other player's character so that it will be facing the right way. each character is basic right now with 4 quads as sides and the front of the character has a differnt texture so you can tell what side is what. I have a 3D room that they can move around in based on the Nehe tutorial 10. So can someone help me with drawing the second character correctly?
The code i used for the first character(the one I would be controling) is below...
glLoadIdentity();
glRotatef(0.0f,yrot,0.0f,0);
glTranslatef(0,-0.95f,0);
glPushMatrix();
//draw character blue
glBindTexture(GL_TEXTURE_2D, texture[3]);
glBegin(GL_QUADS);
//front
glTexCoord2f(0.0f,1.0f); glVertex3f(0.3f, 1.0f,0.0f);
glTexCoord2f(1.0f,1.0f); glVertex3f(-0.3f, 1.0f,0.0f);
glTexCoord2f(1.0f,0.0f); glVertex3f(-0.3f, 0.0f,0.0f);
glTexCoord2f(0.0f,0.0f); glVertex3f(0.3f, 0.0f,0.0f);
glEnd();
glBindTexture(GL_TEXTURE_2D, texture[4]);
glBegin(GL_QUADS);
//right
glTexCoord2f(0.0f,1.0f); glVertex3f(0.3f, 1.0f,0.3f);
glTexCoord2f(1.0f,1.0f); glVertex3f(0.3f, 1.0f,0.0f);
glTexCoord2f(1.0f,0.0f); glVertex3f(0.3f, 0.0f,0.0f);
glTexCoord2f(0.0f,0.0f); glVertex3f(0.3f, 0.0f,0.3f);
//left
glTexCoord2f(0.0f,1.0f); glVertex3f(-0.3f, 1.0f,0.3f);
glTexCoord2f(1.0f,1.0f); glVertex3f(-0.3f, 1.0f,0.0f);
glTexCoord2f(1.0f,0.0f); glVertex3f(-0.3f, 0.0f,0.0f);
glTexCoord2f(0.0f,0.0f); glVertex3f(-0.3f, 0.0f,0.3f);
//back
glTexCoord2f(0.0f,1.0f); glVertex3f(0.3f, 1.0f,0.3f);
glTexCoord2f(1.0f,1.0f); glVertex3f(-0.3f, 1.0f,0.3f);
glTexCoord2f(1.0f,0.0f); glVertex3f(-0.3f, 0.0f,0.3f);
glTexCoord2f(0.0f,0.0f); glVertex3f(0.3f, 0.0f,0.3f);
glEnd();
glPopMatrix();
[edited by - Eric_003 on February 24, 2003 2:51:50 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement