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.

gl. glPushMatrix ();gl. glLightfv ( GL2 . GL_LIGHT0 , GL2 . GL_POSITION , fLightPos . toArray () , 0);// Desenhar um Torus Ver<strong>de</strong>gl. glColor3f (0 , 1f, 0);drawWorld (gl );}gl. glColor4f (0.60f, .40f, .10f, .5f);GlUtil . drawGround ( FloorSize , 1f);gl. glPopMatrix ();private void drawWorld ( GL2 gl) {// Desenhar o Torusgl. glPushMatrix ();gl. glTranslatef (0 , .5f, 0);glut . glutSolidTorus (.1f, .2f, 61 , 37);gl. glPopMatrix ();}// Desenhar esferas aleatoriamentefor ( GLVector s : spherePositions ) {gl. glPushMatrix ();gl. glTranslatef (s.x() , s.y() , s.z ());glut . glutSolidSphere (s.w() , 20 , 10);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;gl. 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.2 Imaging.javapackage pt.ipb . esact .cg. examples ;import java . awt . Bor<strong>de</strong>rLayout ;import java . awt . event . KeyAdapter ;import java . awt . event . KeyEvent ;import java .io. IOException ;import java .io. InputStream ;import java . nio . ByteBuffer ;import java . nio . FloatBuffer ;import java . nio . IntBuffer ;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 ;118

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

Saved successfully!

Ooh no, something went wrong!