private static void setUpShaders() { perPixelShaderProgram = ShaderLoader.loadShaderPair( VERTEX_SHADER_PER_PIXEL_LIGHTING_LOCATION, FRAGMENT_SHADER_PER_PIXEL_LIGHTING_LOCATION); perVertexShaderProgram = ShaderLoader.loadShaderPair( VERTEX_SHADER_PER_VERTEX_LIGHTING_LOCATION, FRAGMENT_SHADER_PER_VERTEX_LIGHTING_LOCATION); currentShaderProgram = perPixelShaderProgram; }
static ShaderProgram loadProgram(String name) { try { return ShaderLoader.load(new FileInputStream("data/varianceShadowMapShaders.xml"), name); } catch (Exception ex) { ex.printStackTrace(); } return null; }
private static void setUpShaders() { shaderProgram = ShaderLoader.loadShaderPair(VERTEX_SHADER_LOCATION, FRAGMENT_SHADER_LOCATION); attributeVertex = glGetAttribLocation(shaderProgram, "attributeVertex"); attributeColour = glGetAttribLocation(shaderProgram, "attributeColour"); attributeNormal = glGetAttribLocation(shaderProgram, "attributeNormal"); uniformAmbientLight = glGetUniformLocation(shaderProgram, "uniformAmbientLight"); uniformLightPosition = glGetUniformLocation(shaderProgram, "uniformLightPosition"); uniformModelViewMatrix = glGetUniformLocation(shaderProgram, "uniformModelViewMatrix"); uniformModelViewProjectionMatrix = glGetUniformLocation(shaderProgram, "uniformModelViewProjectionMatrix"); uniformNormalMatrix = glGetUniformLocation(shaderProgram, "uniformNormalMatrix"); uniformShininess = glGetUniformLocation(shaderProgram, "uniformShininess"); glValidateProgram(shaderProgram); }