Manual de Apoio 2010
Manual de Apoio 2010
Manual de Apoio 2010
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Narizgl. glColor3f (1.0f, 0.3f, 0.3 f);gl. glTranslatef (0.1f, -0.12f, 0.0 f);glu . gluCylin<strong>de</strong>r (quad , 0.04f, 0.0f, 0.3f, 26 , 13);gl. glPopMatrix ();// Chapeugl. glPushMatrix ();gl. glColor3f (0.0f, 0.0f, 0.0 f);gl. glTranslatef (0.0f, 1.17f, 0.0 f);gl. glRotatef ( -90.0f, 1.0f, 0.0f, 0.0 f);glu . gluCylin<strong>de</strong>r (quad , 0.17f, 0.17f, 0.4f, 26 , 13);// Hat brimgl. glDisable ( GL2 . GL_CULL_FACE ); // Pintar ambos os ladosglu . gluDisk (quad , 0.17f, 0.28f, 26 , 13);gl. glEnable ( GL2 . GL_CULL_FACE );gl. glTranslatef (0.0f, 0.0f, 0.40 f);glu . gluDisk (quad , 0.0f, 0.17f, 26 , 13);gl. glPopMatrix ();}gl. glPopMatrix ();@Overri<strong>de</strong>public void reshape ( GLAutoDrawable drawable , int x, int y, int width , int height ) {GL2 gl = drawable . getGL (). getGL2 ();if ( height == 0)height = 1; // prevenir divisao por 0gl. glViewport (0 , 0, canvas . getSize (). width , canvas . getSize (). height );}gl. glMatrixMo<strong>de</strong> ( GL2 . GL_PROJECTION );gl. glLoadI<strong>de</strong>ntity ();float volume = 100 f;float fAspect = ( float ) width / ( float ) height ;glu . gluPerspective (100f, fAspect , .001f, volume * 5f);}C.7 Bezier2D.javapackagept.ipb . esact .cg. examples .c9;import java . awt . Bor<strong>de</strong>rLayout ;import java . awt . Container ;import javax . media . opengl . GL2 ;import javax . media . opengl . GLAutoDrawable ;import javax . media . opengl . GLEventListener ;import javax . media . opengl . awt . GLCanvas ;import javax . media . opengl . glu . GLU ;import javax . swing . JFrame ;import pt.ipb . esact .cg.gl. GLVector ;import pt.ipb . esact .cg.gl. GLVectorList ;import com . jogamp . opengl . util . FPSAnimator ;@SuppressWarnings (" serial ")139