added generic opengl code from tutorial.