/** * Enables the LCD text shader and updates any related state, such as the * gamma lookup table textures. */ static jboolean OGLTR_EnableLCDGlyphModeState(GLuint glyphTextureID, jint contrast) { // bind the texture containing glyph data to texture unit 0 j2d_glActiveTextureARB(GL_TEXTURE0_ARB); j2d_glBindTexture(GL_TEXTURE_2D, glyphTextureID); // bind the texture tile containing destination data to texture unit 1 j2d_glActiveTextureARB(GL_TEXTURE1_ARB); if (cachedDestTextureID == 0) { cachedDestTextureID = OGLContext_CreateBlitTexture(GL_RGB8, GL_RGB, OGLTR_CACHED_DEST_WIDTH, OGLTR_CACHED_DEST_HEIGHT); if (cachedDestTextureID == 0) { return JNI_FALSE; } } j2d_glBindTexture(GL_TEXTURE_2D, cachedDestTextureID); // note that GL_TEXTURE_2D was already enabled for texture unit 0, // but we need to explicitly enable it for texture unit 1 j2d_glEnable(GL_TEXTURE_2D); // create the LCD text shader, if necessary if (lcdTextProgram == 0) { lcdTextProgram = OGLTR_CreateLCDTextProgram(); if (lcdTextProgram == 0) { return JNI_FALSE; } } // enable the LCD text shader j2d_glUseProgramObjectARB(lcdTextProgram); // update the current contrast settings, if necessary if (lastLCDContrast != contrast) { if (!OGLTR_UpdateLCDTextContrast(contrast)) { return JNI_FALSE; } lastLCDContrast = contrast; } // update the current color settings if (!OGLTR_UpdateLCDTextColor(contrast)) { return JNI_FALSE; } // bind the gamma LUT textures j2d_glActiveTextureARB(GL_TEXTURE2_ARB); j2d_glBindTexture(GL_TEXTURE_3D, invGammaLutTextureID); j2d_glEnable(GL_TEXTURE_3D); j2d_glActiveTextureARB(GL_TEXTURE3_ARB); j2d_glBindTexture(GL_TEXTURE_3D, gammaLutTextureID); j2d_glEnable(GL_TEXTURE_3D); return JNI_TRUE; }
/** * Initializes a small texture tile for use with tiled blit operations (see * OGLBlitLoops.c and OGLMaskBlit.c for usage examples). The texture ID for * the tile is stored in the given OGLContext. The tile is initially filled * with garbage values, but the tile is updated as needed (via * glTexSubImage2D()) with real RGBA values used in tiled blit situations. * The internal format for the texture is GL_RGBA8, which should be sufficient * for storing system memory surfaces of any known format (see PixelFormats * for a list of compatible surface formats). */ jboolean OGLContext_InitBlitTileTexture(OGLContext *oglc) { J2dTraceLn(J2D_TRACE_INFO, "OGLContext_InitBlitTileTexture"); oglc->blitTextureID = OGLContext_CreateBlitTexture(GL_RGBA8, GL_RGBA, OGLC_BLIT_TILE_SIZE, OGLC_BLIT_TILE_SIZE); return JNI_TRUE; }