MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / enableShader

Method enableShader

GUI/OpenGL/MiniGL.cpp:775–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773}
774
775void MiniGL::enableShader(const Vector3f& ambientReflectance, const Vector3f& diffuseReflectance, const Vector3f& specularReflectance, const float shininess, const float pointSize)
776{
777 Shader& shader = m_shader;
778 shader.begin();
779 const Matrix4f modelview_matrix(m_modelview_matrix.cast<float>());
780 glUniformMatrix4fv(shader.getUniform("modelview_matrix"), 1, GL_FALSE, &modelview_matrix(0,0));
781 const Matrix4f projection_matrix(m_projection_matrix.cast<float>());
782 glUniformMatrix4fv(shader.getUniform("projection_matrix"), 1, GL_FALSE, &projection_matrix(0,0));
783 glUniform1f(shader.getUniform("pointSize"), pointSize);
784 glUniform1i(shader.getUniform("lighting"), GL_TRUE);
785 glUniform3fv(shader.getUniform("ambientIntensity"), 1, &m_ambientIntensity(0));
786 glUniform3fv(shader.getUniform("diffuseIntensity"), m_numLights, &m_diffuseIntensity(0));
787 glUniform3fv(shader.getUniform("specularIntensity"), m_numLights, &m_specularIntensity(0));
788 glUniform3fv(shader.getUniform("lightPosition"), m_numLights, &m_lightPosition(0));
789 glUniform3fv(shader.getUniform("ambientReflectance"), 1, &ambientReflectance(0));
790 glUniform3fv(shader.getUniform("diffuseReflectance"), 1, &diffuseReflectance(0));
791 glUniform3fv(shader.getUniform("specularReflectance"), 1, &specularReflectance(0));
792 glUniform1f(shader.getUniform("shininess"), shininess);
793
794 glEnable(GL_DEPTH_TEST);
795 glEnable(GL_PROGRAM_POINT_SIZE);
796}
797
798void MiniGL::disableShader()
799{

Callers

nothing calls this directly

Calls 2

getUniformMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected