@Override protected void prepare_glState( GL gl ) { gl.glEnable( GL2.GL_TEXTURE_2D ); gl.glDisable( GL2.GL_BLEND ); } };
@Override public void disableArrays( RenderContext glRenderContext ) { super.disableArrays( glRenderContext ); LOG.trace( "Disabling array state and texture 2d" ); glRenderContext.getContext().glDisableClientState( GL.GL_TEXTURE_COORD_ARRAY ); glRenderContext.getContext().glDisable( GL.GL_TEXTURE_2D ); }
/** * Disables this texture's target (e.g., GL_TEXTURE_2D) in the * given GL state. This method is a shorthand equivalent * of the following OpenGL code: * <pre> * gl.glDisable(texture.getTarget()); * </pre> * <p> * Call is ignored if the {@link GL} object's context * is using a core profile, see {@link GL#isGLcore()}, * or if {@link #getTarget()} is {@link GLES2#GL_TEXTURE_EXTERNAL_OES}. * </p> * <p> * See the <a href="#perftips">performance tips</a> above for hints * on how to maximize performance when using many Texture objects. * </p> * @param gl the current GL object * * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ public void disable(final GL gl) throws GLException { if( !gl.isGLcore() && GLES2.GL_TEXTURE_EXTERNAL_OES != target ) { gl.glDisable(target); } }
/** * @param gl * @param textures * @param shaderProgram */ private void disableTextureStates( GL gl, List<FragmentTexture> textures, ShaderProgram shaderProgram ) { // reset non-standard OpenGL states if ( textures != null && textures.size() > 0 ) { for ( int i = textures.size() - 1; i >= 0; --i ) { int textureUnitId = JOGLUtils.getTextureUnitConst( i ); gl.glClientActiveTexture( textureUnitId ); gl.glActiveTexture( textureUnitId ); gl.glDisable( GL.GL_TEXTURE_2D ); gl.glDisableClientState( GL.GL_TEXTURE_COORD_ARRAY ); } // gl.glActiveTexture( GL.GL_TEXTURE0 ); // gl.glClientActiveTexture( GL.GL_TEXTURE0 ); } // rb: shader program can not be null. shaderProgram.disable( gl ); }
@Override protected void clearBuffers(final int clear) { final GL gl = GLContext.getCurrentGL(); gl.glDisable(GL.GL_SCISSOR_TEST); _parentRenderer.clearBuffers(clear); }
@Override protected void clearBuffers(final int clear) { final GL gl = GLContext.getCurrentGL(); gl.glDisable(GL.GL_SCISSOR_TEST); _parentRenderer.clearBuffers(clear); }
private static void enableFog(final boolean enable, final FogStateRecord record) { final GL gl = GLContext.getCurrentGL(); if (record.isValid()) { if (enable && !record.enabled) { gl.glEnable(GL2ES1.GL_FOG); record.enabled = true; } else if (!enable && record.enabled) { gl.glDisable(GL2ES1.GL_FOG); record.enabled = false; } } else { if (enable) { gl.glEnable(GL2ES1.GL_FOG); } else { gl.glDisable(GL2ES1.GL_FOG); } record.enabled = enable; } }
@Override public void run(final GL gl, final RegionRenderer renderer) { renderer.rs.clearHintMask(RenderState.BITHINT_BLENDING_ENABLED); gl.glDisable(GL.GL_BLEND); if( renderer.rs.isHintMaskSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { // gl.glEnable(GL.GL_DEPTH_TEST); // gl.glDepthFunc(GL.GL_LESS); gl.glDepthMask(true); } } };
private static void setOffsetEnabled(final OffsetType type, final boolean typeEnabled, final OffsetStateRecord record) { final GL gl = GLContext.getCurrentGL(); final int glType = getGLType(type); if (!record.isValid() || typeEnabled != record.enabledOffsets.contains(type)) { if (typeEnabled) { gl.glEnable(glType); } else { gl.glDisable(glType); } } }
private static void setCullEnabled(final boolean enable, final CullState state, final CullStateRecord record) { final GL gl = GLContext.getCurrentGL(); if (!record.isValid() || record.enabled != enable) { if (enable) { gl.glEnable(GL.GL_CULL_FACE); } else { gl.glDisable(GL.GL_CULL_FACE); } record.enabled = enable; } }
private final void setSynchronousImpl() { if(isExtensionARB()) { if(synchronous) { ctx.getGL().glEnable(GL2ES2.GL_DEBUG_OUTPUT_SYNCHRONOUS); } else { ctx.getGL().glDisable(GL2ES2.GL_DEBUG_OUTPUT_SYNCHRONOUS); } if(DEBUG) { System.err.println("GLDebugMessageHandler: synchronous "+synchronous); } } }
private static void setEnabled(final boolean enable, final boolean twoSided, final StencilStateRecord record, final ContextCapabilities caps) { final GL gl = GLContext.getCurrentGL(); if (record.isValid()) { if (enable && !record.enabled) { gl.glEnable(GL.GL_STENCIL_TEST); } else if (!enable && record.enabled) { gl.glDisable(GL.GL_STENCIL_TEST); } } else { if (enable) { gl.glEnable(GL.GL_STENCIL_TEST); } else { gl.glDisable(GL.GL_STENCIL_TEST); } } setTwoSidedEnabled(enable ? twoSided : false, record, caps); record.enabled = enable; }
private static void setTwoSidedEnabled(final boolean enable, final StencilStateRecord record, final ContextCapabilities caps) { final GL gl = GLContext.getCurrentGL(); if (caps.isTwoSidedStencilSupported()) { if (record.isValid()) { if (enable && !record.useTwoSided) { gl.glEnable(GL2.GL_STENCIL_TEST_TWO_SIDE_EXT); } else if (!enable && record.useTwoSided) { gl.glDisable(GL2.GL_STENCIL_TEST_TWO_SIDE_EXT); } } else { if (enable) { gl.glEnable(GL2.GL_STENCIL_TEST_TWO_SIDE_EXT); } else { gl.glDisable(GL2.GL_STENCIL_TEST_TWO_SIDE_EXT); } } } record.useTwoSided = enable; }
private static void enableDepthTest(final boolean enable, final ZBufferStateRecord record) { final GL gl = GLContext.getCurrentGL(); if (enable && (!record.depthTest || !record.isValid())) { gl.glEnable(GL.GL_DEPTH_TEST); record.depthTest = true; } else if (!enable && (record.depthTest || !record.isValid())) { gl.glDisable(GL.GL_DEPTH_TEST); record.depthTest = false; } }
private static void setSingleLightEnabled(final boolean enable, final int index, final LightStateRecord record, final LightRecord lr) { final GL gl = GLContext.getCurrentGL(); if (!record.isValid() || lr.isEnabled() != enable) { if (enable) { gl.glEnable(GLLightingFunc.GL_LIGHT0 + index); } else { gl.glDisable(GLLightingFunc.GL_LIGHT0 + index); } lr.setEnabled(enable); } }
private static void setLightEnabled(final boolean enable, final LightStateRecord record) { final GL gl = GLContext.getCurrentGL(); if (!record.isValid() || record.isEnabled() != enable) { if (enable) { gl.glEnable(GLLightingFunc.GL_LIGHTING); } else { gl.glDisable(GLLightingFunc.GL_LIGHTING); } record.setEnabled(enable); } }
public static void setClippingEnabled(final RendererRecord rendRecord, final boolean enabled) { final GL gl = GLContext.getCurrentGL(); if (enabled && (!rendRecord.isClippingTestValid() || !rendRecord.isClippingTestEnabled())) { gl.glEnable(GL.GL_SCISSOR_TEST); rendRecord.setClippingTestEnabled(true); } else if (!enabled && (!rendRecord.isClippingTestValid() || rendRecord.isClippingTestEnabled())) { gl.glDisable(GL.GL_SCISSOR_TEST); rendRecord.setClippingTestEnabled(false); } rendRecord.setClippingTestValid(true); } }
private static void applyColorMaterial(final ColorMaterial colorMaterial, final MaterialFace face, final MaterialStateRecord record) { if (!record.isValid() || face != record.colorMaterialFace || colorMaterial != record.colorMaterial) { final GL gl = GLContext.getCurrentGL(); if (colorMaterial == ColorMaterial.None) { gl.glDisable(GLLightingFunc.GL_COLOR_MATERIAL); } else { final int glMat = getGLColorMaterial(colorMaterial); final int glFace = getGLMaterialFace(face); gl.getGL2().glColorMaterial(glFace, glMat); gl.glEnable(GLLightingFunc.GL_COLOR_MATERIAL); record.resetColorsForCM(face, colorMaterial); } record.colorMaterial = colorMaterial; record.colorMaterialFace = face; } }
private void renderCopyright() { Texture copyImage = TexturePool.getTexture( glRenderContext, copyrightID ); if ( copyImage != null ) { float tH = copyImage.getHeight(); float tW = copyImage.getWidth(); float quadWidth = tW; float quadHeight = tH; glRenderContext.getContext().glEnable( GL.GL_ALPHA_TEST ); glRenderContext.getContext().glAlphaFunc( GL.GL_GREATER, 0.4f ); draw2D( 0, 0, quadWidth, quadHeight, copyImage, true ); glRenderContext.getContext().glDisable( GL.GL_ALPHA_TEST ); glRenderContext.getContext().glAlphaFunc( GL.GL_ALWAYS, 1 ); } }
private void displayStats( GL gl ) { gl.glDisable( GL.GL_TEXTURE_2D ); gl.glColor3f( 1.0f, 1.0f, 1.0f ); gl.glWindowPos2d( 20, 30 ); glut.glutBitmapString( GLUT.BITMAP_HELVETICA_12, "frame [ms]: " + lastFrameMs + " (max=" + maxFrameMs + ")" ); gl.glWindowPos2d( 20, 44 ); glut.glutBitmapString( GLUT.BITMAP_HELVETICA_12, "avg [ms]: " + allFramesMs / numFrames ); gl.glWindowPos2d( 20, 58 ); glut.glutBitmapString( GLUT.BITMAP_HELVETICA_12, "num frames: " + numFrames ); gl.glWindowPos2d( 20, 72 ); glut.glutBitmapString( GLUT.BITMAP_HELVETICA_12, "enabled datasets: " + currentDatasets ); gl.glWindowPos2d( 20, 86 ); glut.glutBitmapString( GLUT.BITMAP_HELVETICA_12, "available datasets: " + availableDatasets ); gl.glRasterPos2d( 0, 0 ); gl.glColor3f( 1.0f, 1.0f, 1.0f ); }