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.

Fazer o bind do estado da textura ao i<strong>de</strong>ntificadorgl. glBindTexture ( GL2 . GL_TEXTURE_2D , textures . get (i ));// Carregar e Ler a imagem para a nossa texturaTGAImage img = loadTexture ( textureNames . get (i ));ByteBuffer bb = img . getData ();glu . gluBuild2DMipmaps ( GL2 . GL_TEXTURE_2D , GL2 . GL_RGBA ,img . getWidth () , img . getHeight () , img . getGLFormat () ,GL2 . GL_UNSIGNED_BYTE , bb );// Parametros da textura ( ignorar para ja)gl. glTexParameteri ( GL2 . GL_TEXTURE_2D , GL2 . GL_TEXTURE_MAG_FILTER ,GL2 . GL_LINEAR );gl. glTexParameteri ( GL2 . GL_TEXTURE_2D , GL2 . GL_TEXTURE_MIN_FILTER ,GL2 . GL_LINEAR_MIPMAP_LINEAR );gl. glTexParameteri ( GL2 . GL_TEXTURE_2D , GL2 . GL_TEXTURE_WRAP_S ,GL2 . GL_CLAMP_TO_EDGE );gl. glTexParameteri ( GL2 . GL_TEXTURE_2D , GL2 . GL_TEXTURE_WRAP_T ,GL2 . GL_CLAMP_TO_EDGE );// Se afLargest for > 1f o anisotropic filtering e suportadoif( afLargest > 1f)gl. glTexParameterf ( GL2 . GL_TEXTURE_2D ,GL2 . GL_TEXTURE_MAX_ANISOTROPY_EXT ,afLargest );}As Figuras 9.3(a) e 9.3(b) ilustram a diferença entre o filtering e sem e com utilização <strong>de</strong> anisotropic filtering.(a) Sem Anisotropic Filtering(b) Com Anisotropic FilteringFigura 9.3: Utilização <strong>de</strong> Anisotropic Filteing9.3 Compressão <strong>de</strong> TexturasA indiscutível melhoria introduzida pelas texturas é normalmente acompanhada por uma quantida<strong>de</strong> importante<strong>de</strong> memória ocupada e algum overhead <strong>de</strong> processamento. No entanto, o mais preocupante é realmente o espaçoocupado (normalmente na memória gráfica).O OpenGL permite ao utilizador fazer o carregamento <strong>de</strong> texturas comprimidas 1 . Os dados da texturamantém-se comprimidos na memória gráfica, o que po<strong>de</strong> representar um ganho no <strong>de</strong>sempenho aquando doswapping <strong>de</strong> texturas, bem como uma menor quantida<strong>de</strong> <strong>de</strong> memória ocupada.1 Na maior parte das implementações92

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

Saved successfully!

Ooh no, something went wrong!