-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenWidowAndTriangle.cpp
More file actions
47 lines (37 loc) · 1.02 KB
/
Copy pathOpenWidowAndTriangle.cpp
File metadata and controls
47 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#define GLEW_STATIC
#include <GL\glew.h>
#include <GL\freeglut.h>
using namespace std;
void renderScence(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0, 0.0, 0.0, 0.0); //Clear Red
glLineWidth(3);
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(-0.6, -0.75, 0.5);
//glColor3f(0.0, 1.0, 0.0);
glVertex3f(0.6, -0.75, 0);
//glColor3f(0.0, 0.0, 1.0);
//glVertex3f(0, 0.75, 0);
glEnd();
//glBegin(GL_LINES);
//glVertex3f(100.0f, 100.0f, 0.0f); // origin of the line
//glVertex3f(200.0f, 140.0f, 5.0f); // ending point of the line
//glEnd();
glutSwapBuffers();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(500, 500);
glutInitWindowSize(800, 600);
glutCreateWindow("OpenGL First Window");
glEnable(GL_DEPTH_TEST);
//Register callbacks
glutDisplayFunc(renderScence);
glutMainLoop();
return 0;
}