Homework #3 Due Tuesday, September 19, 2017

For this homework, we want to get Frame-Buffer Objects (FBO's) working, understanding the relationship between FBO's, glClear, the depth buffer, and textures. The usage here of FBO's might be common, but will be different than from another lab. Here, we will write once to the texture and then use it for all other frames. Later, we will write to the FBO and use it every frame. Here, we will also use a Geometry shader that will take a point and produce 2 triangles for a simple paint brush.

Here are the complete specs for this lab.

Notes:

Off-Screen Rendering

For more information on rendering to a Frame Buffer Object (FB0), the discussion in the Chapter 9 of the OpenGL SuperBible may help.

Event-based Programming

I used to cover event-based programming, but most of the students know it now. Modern programming is a set of little “handlers” that respond to events like window resized, mouse button, GUI button, etc. The ”order” is hence arbitrary and out of your control. You provide “handlers” to react. With GLUT and HW2, this is done for resize and display (called every time the window needs to be redrawn). Adding mouse and keyboard handlers is similar:
       glutDisplayFunc(display);
       glutReshapeFunc(reshape); 
       glutMouseFunc(mouseEvent);
       glutMotionFunc(mouseMove);

Create new functions mouseEvent and mouseMove that have the GLUT signature. The mouseMove for instance should take as input two integers and does not return anything (or returns a void). This is the method to add points to your scene. Your display method will then draw these points and delete them from the “scene”. To tell the system that it should redraw the window, call glutPostRedisplay at the end of your mouseMove method.