@Override public void init( GLAutoDrawable drawable ) { LOG.trace( "init( GLAutoDrawable ) called" ); GL gl = drawable.getGL(); gl.glClearColor( 1f, 1f, 1f, 0f ); }
@Override public void init(GLAutoDrawable drawable) { //TODO Debug und Trace GL einbauen GL gl = gc.getGL(); logger.info("INIT GL IS: " + gl.getClass().getName()); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); // Enable VSync gl.setSwapInterval(1); // Setup the drawing area and shading mode gl.glClearColor(0.0f, 1.0f, 1.0f, 0f); meminfo = new MemoryInfoProvider(gc).get(); }
public void setBackgroundColor(final ReadOnlyColorRGBA c) { final GL gl = GLContext.getCurrentGL(); _backgroundColor.set(c); gl.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(), _backgroundColor.getAlpha()); }
@Override public final void ppBegin(final GL gl) { if( null == sp ) { throw new IllegalStateException("Not initialized"); } if( 0 == frameStart ) { throw new IllegalStateException("beginFrame not called"); } final GL2ES2 gl2es2 = gl.getGL2ES2(); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glActiveTexture(GL.GL_TEXTURE0 + getTextureUnit()); gl2es2.glDisable(GL.GL_CULL_FACE); gl2es2.glDisable(GL.GL_DEPTH_TEST); gl2es2.glDisable(GL.GL_BLEND); if( !gl2es2.isGLcore() ) { gl2es2.glEnable(GL.GL_TEXTURE_2D); } sp.useProgram(gl2es2, true); gl2es2.glUniform(texUnit0); }
@Override protected void deactivate() { final GL gl = GLContext.getCurrentGL(); if (_active == 1) { final ReadOnlyColorRGBA bgColor = _parentRenderer.getBackgroundColor(); gl.glClearColor(bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue(), bgColor.getAlpha()); gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); ContextManager.getCurrentContext().popEnforcedStates(); if (_neededClip) { _parentRenderer.popClip(); } } _active--; }
private void init( GL gl ) { float[] cc = JOGLUtils.convertColorFloats( request.getBackgroundColor() ); gl.glClearColor( cc[0], cc[1], cc[2], 0.0f ); SunInfo pos = request.getSceneParameters().getSunPosition(); float[] light_position = pos.getEucledianPosition( sceneLatitude ); Vectors3f.scale( -1, light_position ); float[] ambientAndDiffuse = pos.calculateSunlight( sceneLatitude ); // float intens = pos.calcSunlightIntensity( ambientAndDiffuse, 0.5f ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_POSITION, new float[] { light_position[0], light_position[1], light_position[2], 0 }, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_AMBIENT, new float[] { ambientAndDiffuse[0], ambientAndDiffuse[1], ambientAndDiffuse[2], 1 }, 0 ); gl.glMaterialfv( GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[] { ambientAndDiffuse[0], ambientAndDiffuse[1], ambientAndDiffuse[2], 1 }, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_DIFFUSE, new float[] { ambientAndDiffuse[0], ambientAndDiffuse[1], ambientAndDiffuse[2], 1 }, 0 ); }
private void activate() { if (_active == 0) { _oldContext = ContextManager.getCurrentContext(); _context.makeCurrent(); ContextManager.switchContext(_context); ContextManager.getCurrentContext().clearEnforcedStates(); ContextManager.getCurrentContext().enforceStates(_enforcedStates); if (_bgColorDirty) { final GL gl = GLContext.getCurrentGL(); gl.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(), _backgroundColor.getAlpha()); _bgColorDirty = false; } } _active++; }
gl.glClearColor( 0.1f, 0.2f, 0.8f, 0.0f );
@Override public void init( GLAutoDrawable d ) { d.setGL( new DebugGL( d.getGL() ) ); GL gl = d.getGL(); gl.glClearColor( 0.7f, 0.7f, 1f, 0 ); float[] lightAmbient = { 0.4f, 0.4f, 0.4f, 1.0f }; float[] lightDiffuse = { 0.8f, 0.8f, 0.8f, 1.0f }; float[] lightSpecular = { 1.0f, 1.0f, 1.0f, 1.0f }; float[] lightPosition = { 0.0f, 0.0f, 10.0f, 1.0f }; gl.glLightfv( GL.GL_LIGHT0, GL.GL_AMBIENT, lightAmbient, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_DIFFUSE, lightDiffuse, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_SPECULAR, lightSpecular, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_POSITION, lightPosition, 0 ); gl.glEnable( GL.GL_DEPTH_TEST ); gl.glEnable( GL.GL_LIGHT0 ); gl.glEnable( GL.GL_LIGHTING ); gl.glEnable( GL.GL_BLEND ); // enable color and texture blending gl.glBlendFunc( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA ); gl.glMatrixMode( GL.GL_MODELVIEW ); gl.glLoadIdentity(); gl.glEnableClientState( GL.GL_NORMAL_ARRAY ); gl.glEnableClientState( GL.GL_VERTEX_ARRAY ); }
gl.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(), _backgroundColor.getAlpha()); gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, _fboID);