Tuesday, March 20, 2007

Arizona Driver License Holograms

hand. Task 2 Report


/ * humanoid Christian Duran Jorge Lara, Prior 3. Report No. 2 practice, geometric modeling this humanoid is configured in different parts of the body to express some moves. The parameterization is done by means of globalism variables and parameters applied directly on the display * /
# include / / glut library tool
# include

/ / parameters int
torso rot_torso_x = 0; rot_torso_y
int =- 30; rot_torso_z
int = 0;
/ / parameters int head
rot_cabeza_x = 0;
rot_cabeza_y int = 0;
rot_cabeza_z int = 0;

/ / parameters right arm rot_brazoder_x
int = 0; rot_brazoder_y
int = 0; rot_brazoder_z
int = 0; rot_brazoizq_x int = 0; rot_brazoizq_y
int = 0; rot_brazoizq_z
int = 0;
/ / parameters right leg rot_piernader_x
int = 0; rot_piernader_y int = 0; rot_piernader_z
int = 0;
/ / parameters left leg
rot_piernaizq_x int = 0; rot_piernaizq_y int = 0; rot_piernaizq_z
int = 0;
void init (void) / / to clean the buffers
{

glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT)


} / / function-class hub create a cube void cube (void) {


glBegin (GL_QUADS)
glVertex3f (0.5,0.5,0.5), / / \u200b\u200bv1
glVertex3f (-0.5,0.5,0.5) / / v2

glVertex3f (-0.5, -0.5,0.5) / / v3
glVertex3f (0.5, -0.5,0.5) / / v4
glEnd (); glVertex3f (-0.5,0.5, -0.5), / / \u200b\u200bv5

glVertex3f (0.5,0.5, -0.5) / / v6
glVertex3f (0.5, -0.5, -0.5); / / v7 glVertex3f (-0.5, -0.5, -0.5); / / v8

glEnd ();
glBegin (GL_QUADS);
glVertex3f (-0.5,0.5,0.5); / / v2
glVertex3f (-0.5,0.5, -0.5); / / v5

glVertex3f (-0.5, -0.5, -0.5); / / v8
glVertex3f (-0.5, -0.5,0.5); / / v3
glEnd ();
glBegin (GL_QUADS);
glVertex3f (0.5,0.5,0.5) / / v1
glVertex3f (0.5, -0.5,0.5) / / v4
glVertex3f ( 0.5, -0.5, -0.5); / / v7
glVertex3f (0.5,0.5, -0.5); / / v6
glEnd ();

glBegin (GL_QUADS);
glVertex3f (-0.5,0.5, -0.5); / / v5
glVertex3f (-0.5,0.5,0.5); / / v2
glVertex3f (0.5,0.5,0.5) / / v1

glVertex3f (0.5,0.5, -0.5); / / v6
glEnd ( );
glBegin (GL_QUADS);
glVertex3f (0.5, -0.5, -0.5); / / v7
glVertex3f (-0.5, -0.5, -0.5); / / v8
glVertex3f ( -0.5, -0.5,0.5); / / v3
glVertex3f (0.5, -0.5,0.5) / / v4
glEnd ();}


humanoid void ()

{glClear (GL_COLOR_BUFFER_BIT); / / initialize color buffers
glColor3f (0.0, 1.0, 0.0), / / \u200b\u200bchoose the color of lines and solid
matrix glLoadIdentity ();// cleaning

gluLookAt (0.0, 0.0, 10.0, 0.0, 0.0 , 0.0, 0.0, 1.0, 0.0), / / \u200b\u200bhandling of the camera

/ * Build the torso of the humanoid * / glPushMatrix ();// save
an array on the stack
glTranslatef (0.0,2.0,0.0) / / used for translation
glScalef (1.7, 4.0, 1.0), / / \u200b\u200bused to climb
glRotatef (rot_torso_x, 1.0,0.0 , 0.0);
glRotatef (rot_torso_y, 0.0,1.0,0.0) glRotatef
(rot_torso_z, 0.0,0.0,1.0);
/ / glutWireCube (1.0);
cube ();
/ * built the head * /
glPushMatrix ();
glScalef (0.5,0.333,1.5)
glTranslatef (0.0,2.0,0.0) glRotatef
(rot_cabeza_x, 1.0,0.0,0.0) glRotatef
(rot_cabeza_y, 0.0,1.0,0.0) glRotatef
(rot_cabeza_z, 0.0,0.0,1.0) ;
glutWireCube (1.0);
glPopMatrix ();
/ * Build the right arm * /
glPushMatrix ();
glScalef (1.0,0.1666,1.0) glTranslatef
(1.0,2.5,0.0) glRotatef
(rot_brazoder_x, 1.0,0.0,0.0);
glRotatef (rot_brazoder_y, 0.0,1.0,0.0) glRotatef
(rot_brazoder_z, 0.0,0.0,1.0);
glutWireCube (1.0);
/ * Build the right forearm * / glPushMatrix
();
glScalef (1.0,1.3,1.3);
glTranslatef (1.0,0.0,0.0);
/ / glutWireCube (1.0);
cube ();
/ * constructed right hand * / glPushMatrix
();
glScalef (0.25,0.5,1.0)
glTranslatef (2.5,0.0,0.0);
glutWireCube (1.0);
glPopMatrix ();
glPopMatrix (); glPopMatrix
();/* up here is the full right arm * /
/ * Build the left arm * /
glPushMatrix ();
glScalef (1.0,0.1666,1.0)
glTranslatef (- 1.0,2.5,0.0) glRotatef
(rot_brazoizq_x, 1.0,0.0,0.0);
glRotatef (rot_brazoizq_y, 0.0,1.0,0.0) glRotatef
(rot_brazoizq_z, 0.0,0.0,1.0);
glutWireCube (1.0);
/ * Build the left forearm * /
glPushMatrix ();
glScalef (1.0,1.3,1.3);
glTranslatef (-1.0,0.0,0.0)
/ / glutWireCube (1.0);
cube ();
/ * left hand constructed * / glPushMatrix
();
glScalef (0.25,0.5,1.0)
glTranslatef (-2.5,0.0,0.0)
glutWireCube (1.0);
glPopMatrix ();
glPopMatrix ();
glPopMatrix ();// up here the whole left arm
/ * Build the right thigh * /
glPushMatrix ();
glScalef (0.3333,0.6,1.0)
glTranslatef (1.0, - 1.125,0.0)
glRotatef (rot_piernader_x, 1.0,0.0,0.0);
glRotatef (rot_piernader_y, 0.0,1.0,0.0) glRotatef
(rot_piernader_z, 0.0,0.0,1.0);
glutWireCube (1.0);
/ * right calf constructed * /
glPushMatrix ();
glScalef (1.5,1.0,1.0);
glTranslatef (0.0, -1.0,0.0);
/ / glutWireCube (1.0);
cube ();
/ * RF * / glPushMatrix
();
glScalef (1.5,0.25,1.0)
glTranslatef (0.1555, -2.5,0.0);
glutWireCube (1.0);
glPopMatrix ();
glPopMatrix ();
glPopMatrix ();// up here the whole right leg
/ * Build the left thigh * /
glPushMatrix ();
glScalef (0.3333,0.6,1.0)
glTranslatef (-1.0, -1.125,0.0)
glRotatef (rot_piernaizq_x, 1.0,0.0,0.0);
glRotatef (rot_piernaizq_y, 0.0,1.0,0.0) glRotatef
(rot_piernaizq_z, 0.0,0.0,1.0);
glutWireCube (1.0);
/ * left calf constructed * /
glPushMatrix ();
glScalef (1.5,1.0,1.0);
glTranslatef (0.0, -1.0,0.0);
/ / glutWireCube (1.0);
cube ();
/ * Build the left foot * /
glPushMatrix ();
glScalef (1.5,0.25,1.0)
glTranslatef (-0.1555, -2.5,0.0);
glutWireCube (1.0);
glPopMatrix ();
glPopMatrix ( ) glPopMatrix
();/* left leg completes * / glPopMatrix
();/* full torso * /
glFlush ();}

void reshape (int w, int h) {

glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
glMatrixMode (GL_MODELVIEW);
}
/* ARGSUSED1 */
void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(0);
break;
}
}

int main(int argc, char** argv)
{
int parametro;
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE }

0 comments:

Post a Comment