50 likes | 236 Views
Quadrics Ray Wisman rwisman@ius.edu . Objectives. Introduce quadrics Definition quadric – an object having state about how the shape should be drawn; the state does not contain the geometric shape but describes how to draw the shape. Introduce tessellators
E N D
Objectives • Introduce quadrics • Definition quadric – an object having state about how the shape should be drawn; the state does not contain the geometric shape but describes how to draw the shape. • Introduce tessellators • Definition tessellate – To form into a mosaic pattern as by using small squares of stone or glass OpenGL Game Programming
Quadrics • Define a quadric variable GLUquadric *qobj; • Create a quadric object qobj = gluNewQuadric(); • Draw quadric sphere radius ½, 50 longitude and latitude lines centered at origin. gluSphere(qobj,.5,50, 50); • Delete gluDeleteQuadric( obj ); OpenGL Game Programming
Quadrics • Normals for shading gluQuadricNormals(qobj, GLU_SMOOTH); • Drawing style gluQuadricDrawStyle(qobj,GLU_LINE); • Texture coordinates gluQuadricTexture(qobj,GL_TRUE); OpenGL Game Programming
Cylinders and cones glRotatef(90,1,0,0);glRotatef(35,0,1,0); glTranslatef( 0,0, -1.0); GLUquadric *pencil = gluNewQuadric(); gluQuadricNormals(pencil, GLU_SMOOTH); gluCylinder(pencil, .2, .2, 3, 12, 2); glDisable(GL_LIGHTING); glColor3f(.7,.5,0); glTranslatef( 0,0,-.3); gluCylinder(pencil, .2, .2, .3, 12, 2); // Eraser glEnable(GL_LIGHTING); glTranslatef( 0,0, 3.3); gluCylinder(pencil, .2, .0, .3, 12, 2); // Cone writing end OpenGL Game Programming