/** * Create the dem compositing texture shader programs for the given context * * @param gl */ public void createCompositingTextureShaderPrograms( GL gl ) { LOG.debug( "building " + numberOfTextureUnits + " shader programs" ); synchronized ( LOCK ) { if ( this.compositeTextureShaderPrograms == null ) { this.compositeTextureShaderPrograms = new ShaderProgram[this.numberOfTextureUnits]; for ( int i = 0; i < compositeTextureShaderPrograms.length; i++ ) { String shaderSource = CompositingShader.getGLSLCode( i + 1 ); compositeTextureShaderPrograms[i] = new ShaderProgram(); int shaderId = compositeTextureShaderPrograms[i].createFragmentShader( gl, shaderSource ); if ( compositeTextureShaderPrograms[i].attachShader( gl, shaderId ) ) { compositeTextureShaderPrograms[i].linkProgram( gl ); } else { LOG.warn( "Could not attach compositing texture shader program: " + i + " error messages should have been supplied before this message." ); } } } } }
private boolean setupShaderProgram( GL gl ) { this.shaderProgram = new ShaderProgram(); int vertShaderId = shaderProgram.createVertexShader( gl, createVertexShader() ); int fragShaderId = shaderProgram.createFragmentShader( gl, createFragmentShader( 1 ) ); if ( !shaderProgram.attachShader( gl, vertShaderId ) ) { // rb: unable to attach the given shader id, ignoring. LOG.warn( "Could not attach the vertex part to the color map shader program, ignoring color map." ); return false; } if ( !shaderProgram.attachShader( gl, fragShaderId ) ) { LOG.warn( "Could not attach the fragment part to the color map shader program, ignoring color map." ); return false; } if ( !shaderProgram.linkProgram( gl ) ) { LOG.warn( "Could not link the shaders to the color map shader program, ignoring color map." ); return false; } return true; }