Advanced Computer Graphics: Laboratory Project

BACK TO INDEX

Application Framework

bleifrei

Collection of useful classes for initializing OpenGL and handling for instance textures and effects.

main.cpp

The function applicationMain is a good starting point for creating your own application. It contains the main loop and handles camera movement and updates the screen each frame.

The class EventListener implements both WindowEventListener and KeyboardEventListener. It handles the events:

There are also global camera variables used for animating the camera. Note that global variables are evil and should not be used in real projects.

render.cpp

Initialization of the scene is done by the function initRender. It loads the scene file, the environment map and loads the effect file. Calls loadScene and initEffect. Shutdown is handled by shutdownRender.

The function initEffect initializes the effect file and loads pointers to all parameters and techniques used for rendering.

The scene is loaded in the function loadScene. For your projects this function will probably have to be replaced by a function that loads a 3DS file (using l3ds for example) or a format of your choice.

The function assignShaders maps shaders to materials based on their properties. It is done here in a rather crude way and it will not work in a larger project. See it as a good example of how not to do it and do not reuse this code.

Rendering of the scene takes place in the function renderScene. This code will have to be rewritten in order to be used in your own project. If you use l3ds, there is a simple example of how rendering can be done in its source code package.

The function render makes sure that there is a valid effect file loaded before updating the camera/light parameters and calling renderScene.

gui

This folder cointains implementations of the gui components used for the application. The most interesting component should be FXWindow which implements the code for the Post-processing window. The class overloads the onRenderOverlay from the GUIComponent class.


BACK TO INDEX