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 . add (4f, 0f, 0f); // End (u1)}// v2ctrlPoints . add ( -4f, 0f, -4f); // Start (u2)ctrlPoints . add ( -2f, ( float ) ( Math . sin (a2) * 8f - 4f), -4f); // Control (u2)ctrlPoints . add (4f, 0f, -4f); // End (u2)private void setupLight ( GL2 gl) {// Setup light parametersgl. glLightMo<strong>de</strong>lfv ( GL2 . GL_LIGHT_MODEL_AMBIENT , fNoLight , 0);gl. glLightMo<strong>de</strong>li ( GL2 . GL_LIGHT_MODEL_COLOR_CONTROL ,GL2 . GL_SEPARATE_SPECULAR_COLOR );gl. glLightfv ( GL2 . GL_LIGHT0 , GL2 . GL_AMBIENT , fLowLight , 0);gl. glLightfv ( GL2 . GL_LIGHT0 , GL2 . GL_DIFFUSE , fBrightLight , 0);gl. glLightfv ( GL2 . GL_LIGHT0 , GL2 . GL_SPECULAR , fBrightLight , 0);gl. glEnable ( GL2 . GL_LIGHTING );gl. glEnable ( GL2 . GL_LIGHT0 );}// Utilizar color trackinggl. glEnable ( GL2 . GL_COLOR_MATERIAL );gl. glColorMaterial ( GL2 . GL_FRONT , GL2 . GL_AMBIENT_AND_DIFFUSE );gl. glMateriali ( GL2 . GL_FRONT , GL2 . GL_SHININESS , 128);public void display ( GLAutoDrawable drawable ) {GL2 gl = drawable . getGL (). getGL2 ();gl. glClear ( GL2 . GL_COLOR_BUFFER_BIT | GL2 . GL_DEPTH_BUFFER_BIT );updateControlPoints ();// Componente Especulargl. glMaterialfv ( GL2 . GL_FRONT , GL2 . GL_SPECULAR , fBrightLight , 0);// Posicao da Luzgl. glLightfv ( GL2 . GL_LIGHT0 , GL2 . GL_POSITION , fLightPos . toArray () , 0);float umin = 0f; // Valor minimo do ufloat umax = 10f; // Valor maximo do ufloat vmin = 0f; // Valor minimo do vfloat vmax = 10f; // Valor maximo do vgl. glMap2f (GL2 . GL_MAP2_VERTEX_3 , // Tipo <strong>de</strong> dados geradosumin , // Valor minimo do uumax , // Valor maximo do u3, // Distancia entre pontos ( dominio u)3, // Numero <strong>de</strong> pontos <strong>de</strong> controlo ( dominio u)vmin , // Valor minimo do vvmax , // Valor maximo do v9, // Distancia entre pontos ( dominio v)3, // Numero <strong>de</strong> pontos <strong>de</strong> controlo ( dominio v)ctrlPoints . toFloatBuffer () // FloatBuffer contendo pontos <strong>de</strong> controlo);// Activar o Evaluatorgl. glEnable ( GL2 . GL_MAP2_VERTEX_3 );// Desenhar os vertices da superficiegl. glColor3f (0f, 0f, 1f);gl. glMapGrid2d (10 , umin , umax , 10 , vmin , vmax );gl. glEvalMesh2 ( GL2 . GL_FILL , ( int )umin , ( int )umax , ( int )vmin , ( int ) vmax );// Desenhar Pontos <strong>de</strong> Controlo146

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

Saved successfully!

Ooh no, something went wrong!