13.07.2015 Views

Manual de Apoio 2010

Manual de Apoio 2010

Manual de Apoio 2010

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

@Overri<strong>de</strong>public void init ( GLAutoDrawable drawable ) {GL2 gl = drawable . getGL (). getGL2 ();}// Grayish backgroundgl. glClearColor ( fLowLight [0] , fLowLight [1] , fLowLight [2] , fLowLight [3]);// Cull backs of polygonsgl. glCullFace ( GL2 . GL_BACK );gl. glFrontFace ( GL2 . GL_CCW );gl. glEnable ( GL2 . GL_CULL_FACE );gl. glEnable ( GL2 . GL_DEPTH_TEST );setupLight (gl );spherePositions = GlUtil . generateRandomPositions ( FloorSize , NumSpheres );setupTextures (gl );setupCubeMap (gl );private TGAImage loadTexture ( String name ) {TGAImage img = null ;try {InputStream stream = Anisotropic . class . getResourceAsStream ( name );img = TGAImage . read ( stream );stream . close ();} catch ( IOException e) {e. printStackTrace ();System . exit (0);}return img ;}private void setupTextures ( GL2 gl) {// Activar as texturasgl. glEnable ( GL2 . GL_TEXTURE_2D );// Obter os i<strong>de</strong>ntificadorestextures = IntBuffer . allocate ( NumTextures ); // 2 texturas + 1 cubogl. glGenTextures ( NumTextures , textures );// Configuracao do Texture Environmentgl. glTexEnvi ( GL2 . GL_TEXTURE_ENV , GL2 . GL_TEXTURE_ENV_MODE , GL2 . GL_MODULATE );// Texturas da GeometriatextureNames . add (" earth . tga "); // Para os circulostextureNames . add (" grass . tga ");// Texturas do Cube MaptextureNames . add (" cubemap / right . tga ");textureNames . add (" cubemap / left . tga ");textureNames . add (" cubemap /up.tga ");textureNames . add (" cubemap / down . tga ");textureNames . add (" cubemap / backward . tga ");textureNames . add (" cubemap / forward . tga ");// Carregar as texturas da Geometriafor ( int i = 0; i < CubeStartIn<strong>de</strong>x ; i ++) {// Fazer o bind do estado da textura ao i<strong>de</strong>ntificadorgl. glBindTexture ( GL2 . GL_TEXTURE_2D , textures . get (i ));133

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

Saved successfully!

Ooh no, something went wrong!