|
|
@@ -214,54 +214,3 @@ opengl_uniform_data & opengl_manager::data(identity<shader_program> program) {
|
|
|
}
|
|
|
return data;
|
|
|
}
|
|
|
-
|
|
|
-namespace graphics { namespace shaders {
|
|
|
- void activate(identity<shader_program> program) {
|
|
|
- // 100. Use the shader program ID to "turn it on" for all subsequent drawing
|
|
|
- glUseProgram(program.id);
|
|
|
-
|
|
|
- /*
|
|
|
- // 101. Enable texturing and Bind texture(s) to GPU texture units
|
|
|
- glActiveTexture(GL_TEXTURE3);
|
|
|
- glEnable(GL_TEXTURE_2D);
|
|
|
- glBindTexture(GL_TEXTURE_2D, emissiveTextureID);
|
|
|
-
|
|
|
- glActiveTexture(GL_TEXTURE2);
|
|
|
- glEnable(GL_TEXTURE_2D);
|
|
|
- glBindTexture(GL_TEXTURE_2D, specularTextureID);
|
|
|
-
|
|
|
- glActiveTexture(GL_TEXTURE1);
|
|
|
- glEnable(GL_TEXTURE_2D);
|
|
|
- glBindTexture(GL_TEXTURE_2D, normalTextureID);
|
|
|
-
|
|
|
- glActiveTexture(GL_TEXTURE0);
|
|
|
- glEnable(GL_TEXTURE_2D);
|
|
|
- glBindTexture(GL_TEXTURE_2D, diffuseTextureID);
|
|
|
- */
|
|
|
-
|
|
|
- // 102. Get the location # of each named uniform you wish to pass in to the
|
|
|
- // shader
|
|
|
- int timeUniformLocation = glGetUniformLocation(program.id, "u_time");
|
|
|
- int scale = glGetUniformLocation(program.id, "Scale");
|
|
|
- int diffuseMap = glGetUniformLocation(program.id, "u_diffuseMap");
|
|
|
- int normalMap = glGetUniformLocation(program.id, "u_normalMap");
|
|
|
- int specularMap = glGetUniformLocation(program.id, "u_specularMap");
|
|
|
- int emissiveMap = glGetUniformLocation(program.id, "u_emissiveMap");
|
|
|
- int debugWave = glGetUniformLocation(program.id, "g_debugWave");
|
|
|
-
|
|
|
- // 103. Set the uniform values, including the texture unit numbers for
|
|
|
- // texture (sampler) uniforms
|
|
|
- // Env::GetCurrentTimeSeconds()
|
|
|
- glUniform1f(timeUniformLocation, env::clock::current_time<float>());
|
|
|
- glUniform1f(scale, 2.f);
|
|
|
- glUniform1i(debugWave, 1); // TODO: m_waveEffectOn in ShaderProgram??
|
|
|
- // for GL_TEXTURE0, texture unit 0
|
|
|
- glUniform1i(diffuseMap, 0);
|
|
|
- // for GL_TEXTURE1, texture unit 1
|
|
|
- glUniform1i(normalMap, 1);
|
|
|
- // for GL_TEXTURE2, texture unit 2
|
|
|
- glUniform1i(specularMap, 2);
|
|
|
- // for GL_TEXTURE3, texture unit 3
|
|
|
- glUniform1i(emissiveMap, 3);
|
|
|
- }
|
|
|
-}}
|