Skip to content

Instantly share code, notes, and snippets.

@chareice
Created October 7, 2014 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chareice/7b2a85301bdc7588bb70 to your computer and use it in GitHub Desktop.
Save chareice/7b2a85301bdc7588bb70 to your computer and use it in GitHub Desktop.
#include <OpenGL/gl3.h>
#include <GLUT/glut.h>
void init(){
glClearColor(1.0, 1.0, 1.0, 0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0, 200, 0, 150);
}
void lineSegment(){
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1, 0, 0);
glBegin(GL_LINES);
glVertex2i(180, 15);
glVertex2i(10, 145);
glEnd();
glFlush();
}
int main(int argc, char *argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(50, 100);
glutInitWindowSize(400, 300);
glutCreateWindow("test");
init();
glutDisplayFunc(lineSegment);
glutMainLoop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment