Write and Test render()
main()
Now we are going to use the shaders and render the scene.
render()
add one render() function in main.cpp
void render()
{
glViewport(0,0,width,height);
// comment glBindFramebuffer to test rendering
glBindFramebuffer(GL_FRAMEBUFFER, colourFBO);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
scene->setShaderId(bloomrenderShader);
scene->draw(matModelRoot, matView, matProj);
}init shaders in the shader section in main()
//==============================================================================
// added for LabA10 Bloom
bloomrenderShader = initShader("shaders/bloom.vert", "shaders/bloomrender.frag");
setLightPosition(lightPos);
setViewPosition(viewPos);call render() in the event loop
Test render()
comment the line of glBindFrameBuffer() so that you can see the rendering in your window
You are going to see something similar to the following:

Last updated