Skip to content

Instantly share code, notes, and snippets.

@markusdosch
Last active January 16, 2019 00:49
Show Gist options
  • Save markusdosch/e52bd29472db8032e28f82b6578e2a7b to your computer and use it in GitHub Desktop.
Save markusdosch/e52bd29472db8032e28f82b6578e2a7b to your computer and use it in GitHub Desktop.
GLFW & OpenGL learnings

General Introduction into OpenGL

GLFW windows by default use double buffering. That means that each window has two rendering buffers; a front buffer and a back buffer. The front buffer is the one being displayed and the back buffer the one you render to.

When the entire frame has been rendered, the buffers need to be swapped with one another, so the back buffer becomes the front buffer and vice versa.

glfwSwapBuffers(window);
void glColor4i(	GLint  	red,
 	GLint  	green,
 	GLint  	blue,
 	GLint  	alpha);
glEnable(GL_DEPTH_TEST);

general information about what a depth-/z-buffer is: https://de.wikipedia.org/wiki/Z-Buffer

glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // clear colors to black
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // apply cleared color buffer & clear the depth buffer
void glMatrixMode(	GLenum mode);

Drawing with OpenGL

Good tutorial: https://wiki.delphigl.com/index.php/glBegin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment