Skip to content

Instantly share code, notes, and snippets.

@tuttlem
Created December 1, 2012 07:14
Show Gist options
  • Save tuttlem/4180941 to your computer and use it in GitHub Desktop.
Save tuttlem/4180941 to your computer and use it in GitHub Desktop.
OpenGL2D - drawing
/* note that we're not clearing the depth buffer */
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
/* draw a triangle */
glBegin(GL_TRIANGLES);
glColor3ub(255, 0, 0);
glVertex2d(0, 0);
glColor3ub(0, 255, 0);
glVertex2d(100,0);
glColor3ub(0, 0, 255);
glVertex2d(50, 50);
glEnd();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment