void gl4::DeferredRender::render(void (*renderFunc)(void)) { // start stage 1 _standard.clear(); _standard.bind(); bindDefaultShader(); renderFunc(); gl4::ShaderManager::getInstance()->unbindShader(); _standard.unbind(); // end stage 1 // start stage 2 gl4::ShaderManager::getInstance()->bindShader(deferred2); // orthogonal projection glUniformMatrix4fv(UNIFORM_LOCATION(UNIFORM_PROJECTION), 1, GL_FALSE, &_orthogonalProjectionMatrix[0][0]); glm::mat4 transform = glm::mat4(1.0); glUniformMatrix4fv(UNIFORM_LOCATION(UNIFORM_MODELTRANSFORM), 1, GL_FALSE, &transform[0][0]); // render the FBO texture _standard.bindTextures(); _quad.render(); // unbind texture and shader glBindTexture(GL_TEXTURE_2D,0); gl4::ShaderManager::getInstance()->unbindShader(); // end stage 2 }
void Camera::render() { glLoadIdentity(); glBindFramebuffer(GL_FRAMEBUFFER, target); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); useView(); renderFunc(this); }