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.

public void init ( GLAutoDrawable drawable ) {GL2 gl = drawable . getGL (). getGL2 ();// Grayish backgroundgl. glClearColor (0f, 0f, 0f, 0f);}try {InputStream stream = Imaging . class . getResourceAsStream (" horse . tga ");img = TGAImage . read ( stream );bb = img . getData ();stream . close ();} catch ( IOException e) {e. printStackTrace ();}@Overri<strong>de</strong>public void display ( GLAutoDrawable drawable ) {GL2 gl = drawable . getGL (). getGL2 ();// Clear the window with current clearing colorgl. glClear ( GL2 . GL_COLOR_BUFFER_BIT | GL2 . GL_DEPTH_BUFFER_BIT );// Armazena a informacao do viewPort lida com glGet// Contem : (x, y, width , height )IntBuffer iViewport = IntBuffer . allocate (4);// Tabela <strong>de</strong> cores invertida (3 cores * 256 niveis )ByteBuffer invertTable = ByteBuffer . allocate (256 * 3);// Matriz ( convolution kernel ) para efectuar o sharpenFloatBuffer mSharpen = FloatBuffer . wrap ( new float [] {0.0f, -1.0f, 0.0f,-1.0f, 5.0f, -1.0f,0.0f, -1.0f, 0.0 f});// Matriz ( convolution kernel ) para efectuar o embossFloatBuffer mEmboss = FloatBuffer . wrap ( new float [] {2.0f, 0.0f, 0.0f,0.0f, -1.0f, 0.0f,0.0f, 0.0f, -1.0f});// Matriz ( convolution kernel ) para efectuar gaussian blur/*| 1 2 1 || 2 4 2 || 1 2 1 |*/float norm = 16f; // somatorio dos valores da matrizFloatBuffer mGaussian = FloatBuffer . wrap ( new float [] {1f/norm , 2f/norm , 1f/norm ,2f/norm , 4f/norm , 2f/norm ,1f/norm , 2f/norm , 1f/ norm});// Posicao do raster comeca no canto inferior esquerdo por omissaogl. glRasterPos2i (0 , 0);// Ler o estado actual do viewportgl. glGetIntegerv ( GL2 . GL_VIEWPORT , iViewport );// Esticar a imagem para ficar do tamanho do viewport120

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

Saved successfully!

Ooh no, something went wrong!