13.07.2015 Views

Manual de Apoio 2010

Manual de Apoio 2010

Manual de Apoio 2010

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ctrlPoints . size () , // Numero <strong>de</strong> pontos <strong>de</strong> controloctrlPoints . toFloatBuffer () // FloatBuffer contendo pontos <strong>de</strong> controlo);// Activar o Evaluatorgl. glEnable ( GL2 . GL_MAP1_VERTEX_3 );// Desenhar os vertices da curva/*gl. glColor3f (0f, 0f, 0f);gl. glBegin ( GL2 . GL_LINE_STRIP );for ( float i= umin ; i< umax ; i ++)gl. glEvalCoord1f (i);gl. glEnd ();*/gl. glColor3f (0f, 0f, 0f);gl. glMapGrid1d (100 , umin , umax );gl. glEvalMesh1 ( GL2 . GL_LINE , ( int )umin , ( int ) umax );// Desenhar Pontos <strong>de</strong> Contrologl. glPointSize (5.0 f);gl. glColor3f (1f, 0f, 0f);gl. glBegin ( GL2 . GL_POINTS );for ( GLVector point : ctrlPoints )point . draw ();gl. glEnd ();}@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 ();glu . gluOrtho2D ( -10f, 10f, -10f, 10f);}gl. glMatrixMo<strong>de</strong> ( GL2 . GL_MODELVIEW );gl. glLoadI<strong>de</strong>ntity ();}C.8 Bezier3D.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. CGEngine ;import pt.ipb . esact .cg.gl. GLVector ;141

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!