All notes




Matrix44. There are multiple coordinate Systems involved in 3D Graphics:

OpenGLWiki. The model matrix is used to describe where an object exists in the world. The view matrix is used to describe the vantage point of our view. The view matrix can be thought of as the position and angle of a camera used to take a picture. The projection matrix is used to give our view perspective such as making close objects appear larger than distant objects. The projection matrix also provides a field of view which can be thought of as a camera lens; you can decide to use a wide-angle lens or a telephoto lens.

Cartersian Space in 3D (left), and Object Space (right).

If we want to position the cube in World coordinates at position X=5, Y=0, Z=0, multiply each vertix with the World matrix


Viewing volume

FalloutSoftware. The Viewing Volume is also known as the Clipping volume or the Frustum. Here's the visual representation of the viewing volume.

There are two planes, the viewing plane and the far clipping plane. The viewing plane is actually the screen and the far plan indicates how far you can "see", whatever is behind the far clipping plane will not be visible. The viewing volume is the space between those two planes. The viewing volume is sometimes called clipping volume because you usually want to clip your polygons against it.

VAOs, VBOs, Vertex and Fragment Shaders



Die. glrasterpos3f.






OpenGL and Direct3D (DirectX)

Wikibooks gives a good reference on the comparison.




Mac OS

Wikibooks. To use GLUT and OpenGL from within Xcode:

  1. open Xcode located in "/Developer/Applications/"
  2. choose "New Project" from the file menu
  3. choose "Command Line Tool" under the Application template for Mac OS X
  4. choose type "C++"
  5. enter your desired project name and directory
  6. Add frameworks: OpenGL and GLUT. Frameworks are stored in "/System/Library/Frameworks/", from there select and add GLUT & OpenGL.
When #including OpenGL & GLUT header files within Xcode, make sure to do so like this:
#include <OpenGL/gl.h>
#include <OpenGl/glu.h>
#include <GLUT/glut.h>


sudo yum -y install mesa-libGL
sudo yum -y install mesa-libGL-devel

# See what versions of mesa-libGl are available for your release
yum search --showduplicates mesa-libGL



About DRI

Wikipedia. The Direct Rendering Infrastructure (DRI) is a framework for allowing direct access to graphics hardware under the X Window System in a safe, efficient way. The main use of DRI is to provide hardware acceleration for the Mesa implementation of OpenGL. DRI has also been adapted to provide OpenGL acceleration on a framebuffer console without a display server running.

GLUT (OpenGL Utility Toolkit), freeglut is recommended. GLw (OpenGL widget library). Unless you're using very old Xt/Motif applications with OpenGL, you shouldn't need it.


On Linux-based systems you'll want to follow the Linux ABI standard. Basically you'll want the following:

/usr/include/GL/gl.h - the main OpenGL header
/usr/include/GL/glu.h - the OpenGL GLU (utility) header
/usr/include/GL/glx.h - the OpenGL GLX header
/usr/include/GL/glext.h - the OpenGL extensions header
/usr/include/GL/glxext.h - the OpenGL GLX extensions header
/usr/include/GL/osmesa.h - the Mesa off-screen rendering header
/usr/lib/ - a symlink to
/usr/lib/ - a symlink to
/usr/lib/ - the actual OpenGL/Mesa library. xyz denotes the Mesa version number. 


# Find the dir location.
find /usr -type d -name dri
# Usually, /usr/lib64/dri

# --prefix=usr: Install in /usr/lib and /usr/include.
./configure --prefix=/usr --libdir=/usr/lib64 --with-dri-driverdir=/usr/lib64/dir
sudo make install complains about missing function

# Check what is missing.
ldd -r /usr/lib64/ =>  (0x00007fff2a5ff000) => /usr/lib64/ (0x00007f72a2c27000) => /usr/lib64/ (0x00007f72a29c1000) => /usr/lib64/ (0x00007f72a2684000) => /lib64/ (0x00007f72a22f0000) => /usr/lib64/tls/ (0x00007f72a20ec000) => /usr/lib64/ (0x00007f729f411000) => /usr/lib64/ (0x00007f729f1ff000) => /lib64/ (0x00007f729effa000) => /usr/lib64/ (0x00007f729edf2000) => /usr/lib64/ (0x00007f729ebd6000) => /usr/lib64/ (0x00007f729e9b7000)
		/lib64/ (0x000000332f200000) => /lib64/ (0x00007f729e733000) => /lib64/ (0x00007f729e52f000) => /usr/lib64/ (0x00007f729e32b000)
	undefined symbol: xmPrimitiveClassRec	(/usr/lib64/
	undefined symbol: _XmStrings	(/usr/lib64/

# Find what provides the missing piece.
for i in $(ls /usr/lib64/*.so); do
    echo "========="
    echo $i
    strings $i | grep -i xmPrimitiveClassRec

# Ahh, so it is!!!
# ======
# /usr/lib64/
# xmPrimitiveClassRec