OpenGL

An intro to Modern OpenGL

Reading

Read over Chapters 2. Don't worry about programming details or the actual Sierpinski Gasket in Chapter 2. Read for concepts and ideas, not code fragments. While the book uses glut as the windowing environment, we will be using QT which has similar functionality but completely different syntax.

Class startup

Practicing git

verify that any recent changes have been committed to your working branch
git status
git add <file>
git commit
switch to the master branch and get changes
git checkout master
git pull
git checkout working
git merge master
You should have a Friday.txt file. This file is silly. You can remove it from version control
git rm Friday.txt
git commit
Use git rm or git mv to remove/move files under version control.

Project Preview

Project 1
If you would like to work with a partner, please email me your partner's name.

Code

Wednesday

QT and OpenGL

The class QGLWidget creates an OpenGL context inside QT. OpenGL functions are called within this context. Additionally, QT has some OpenGL wrapper classes beginning with the prefix QGL.

Creating a QT OpenGL application

Friday

Wednesday Review

Next Steps

As of Wednesday, we has three vertices of a triangle sitting in a VBO in GPU memory. The next step is to define, create, load, and compile shaders. The vertex shader runs first and takes vertex data from the VBO and outputs geometry in clip coordinates. This geometry is then clipped, and rasterized, and fed to the fragment shader which runs on each fragmenet, or potential output pixel. The output of the fragment shader is written to a framebuffer and displayed in the viewport. Once each shader is compiled, we define, create, and link a shader program, which is the combination of a vertex shader and a fragment shader. Finally, we are ready to draw. The main steps are: Once the geometric data are copied to GPU memory, almost everything else happens on the GPU. paintGL is just issuing commands to the GPU. The GPU itself will process those commands.

Shaders, GLSL

Modifying Shaders