Fixed OpenGL fencepost issue and cleaned up code (unix)