GLUSvoid reshape(GLUSint width, GLUSint height) { GLfloat projectionMatrix[16]; glViewport(0, 0, width, height); glusMatrix4x4Perspectivef(projectionMatrix, 40.0f, (GLfloat) width / (GLfloat) height, 1.0f, 100.0f); glUseProgram(g_program.program); // Just pass the projection matrix. The final matrix is calculated in the shader. glUniformMatrix4fv(g_projectionMatrixLocation, 1, GL_FALSE, projectionMatrix); glUseProgram(g_programFur.program); // Just pass the projection matrix. The final matrix is calculated in the shader. glUniformMatrix4fv(g_projectionMatrixFurLocation, 1, GL_FALSE, projectionMatrix); }
GLUSvoid reshape(GLUSint width, GLUSint height) { GLfloat projectionMatrix[16]; // glUseProgram(g_program.program); glusMatrix4x4Perspectivef(projectionMatrix, 40.0f, (GLfloat) width / (GLfloat) height, 1.0f, 100.0f); glUniformMatrix4fv(g_projectionMatrixLocation, 1, GL_FALSE, projectionMatrix); // glUseProgram(g_programShadow.program); glUniformMatrix4fv(g_projectionMatrixShadowLocation, 1, GL_FALSE, projectionMatrix); }
GLUSvoid reshape(GLUSint width, GLUSint height) { GLfloat modelMatrix[16]; GLfloat modelViewMatrix[16]; GLfloat normalMatrix[9]; GLfloat lightDirection[3]; g_width = width; g_height = height; reshapeWavefront(width, height); // glViewport(0, 0, width, height); glusMatrix4x4Perspectivef(g_viewProjectionMatrix, 40.0f, (GLfloat) width / (GLfloat) height, 1.0f, 100.0f); glusMatrix4x4Multiplyf(g_viewProjectionMatrix, g_viewProjectionMatrix, g_viewMatrix); glUseProgram(g_program.program); glUniformMatrix4fv(g_viewProjectionMatrixLocation, 1, GL_FALSE, g_viewProjectionMatrix); glusMatrix4x4Identityf(modelMatrix); glusMatrix4x4Translatef(modelMatrix, 0.0f, 0.0f, 3.0f); glusMatrix4x4RotateRxf(modelMatrix, -90.0f); glUniformMatrix4fv(g_modelMatrixLocation, 1, GL_FALSE, modelMatrix); // Calculation is in camera space glusMatrix4x4Multiplyf(modelViewMatrix, g_viewMatrix, modelMatrix); glusMatrix4x4ExtractMatrix3x3f(normalMatrix, modelViewMatrix); glUniformMatrix3fv(g_normalMatrixLocation, 1, GL_FALSE, normalMatrix); glusMatrix4x4MultiplyVector3f(lightDirection, g_viewMatrix, g_light.direction); // Direction already normalized glUniform3fv(g_lightDirectionLocation, 1, lightDirection); }
GLUSvoid reshape(GLUSint width, GLUSint height) { glViewport(0, 0, width, height); glusMatrix4x4Perspectivef(g_projectionMatrix, 40.0f, (GLfloat) width / (GLfloat) height, 1.0f, 100.0f); }