public void enable( RenderContext glRenderContext ) {
GL gl = glRenderContext.getContext();
if ( shaderProgram == null ) {
if ( !setupShaderProgram( gl ) ) {
this.shaderProgram = null;
return;
}
}
if ( shaderProgram.useProgram( gl ) ) {
int mCLoc = gl.glGetUniformLocation( shaderProgram.getOGLId(), UNIFORM_MIN_COLOR );
int maxCLoc = gl.glGetUniformLocation( shaderProgram.getOGLId(), UNIFORM_HEIGHT_COLOR );
int dVLoc = gl.glGetUniformLocation( shaderProgram.getOGLId(), UNIFORM_DIFF_VEC );
int miZLoc = gl.glGetUniformLocation( shaderProgram.getOGLId(), UNIFORM_MIN_Z );
if ( mCLoc == -1 || maxCLoc == -1 || dVLoc == -1 || miZLoc == -1 ) {
LOG.warn( "Could not get uniform location of Vertex shader, no color map is enabled: {},{},{},{}.",
new Object[] { mCLoc, maxCLoc, dVLoc, miZLoc, } );
return;
}
gl.glUniform4f( mCLoc, minColor[0], minColor[1], minColor[2], 1 );
gl.glUniform4f( maxCLoc, heightColor[0], heightColor[1], heightColor[2], 1 );
gl.glUniform4f( dVLoc, difVec[0], difVec[1], difVec[2], 1 );
gl.glUniform4f( miZLoc, zMin, invDifZ, 0, 0 );
}
}