private void renderGlyph ( Glyph glyph , int width , int height ) throws SlickException { // Draw the glyph to the scratch image using Java2D. scratchGraphics . setComposite ( AlphaComposite . Clear ) ; scratchGraphics . fillRect ( 0 , 0 , MAX_GLYPH_SIZE , MAX_GLYPH_SIZE ) ; scratchGraphics . setComposite ( AlphaComposite . SrcOver ) ; scratchGraphics . setColor ( java . awt . Color . white ) ; for ( Iterator iter = unicodeFont . getEffects ( ) . iterator ( ) ; iter . hasNext ( ) ; ) ( ( Effect ) iter . next ( ) ) . draw ( scratchImage , scratchGraphics , unicodeFont , glyph ) ; glyph . setShape ( null ) ; // The shape will never be needed again. WritableRaster raster = scratchImage . getRaster ( ) ; int [ ] row = new int [ width ] ; for ( int y = 0 ; y < height ; y ++ ) { raster . getDataElements ( 0 , y , width , 1 , row ) ; scratchIntBuffer . put ( row ) ; } GL . glTexSubImage2D ( SGL . GL_TEXTURE_2D , 0 , pageX , pageY , width , height , SGL . GL_BGRA , SGL . GL_UNSIGNED_BYTE , scratchByteBuffer ) ; scratchIntBuffer . clear ( ) ; glyph . setImage ( pageImage . getSubImage ( pageX , pageY , width , height ) ) ; }
Loads a single glyph to the backing texture if it fits .