-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht1.cpp
More file actions
63 lines (49 loc) · 1.52 KB
/
t1.cpp
File metadata and controls
63 lines (49 loc) · 1.52 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<stdio.h>
#include <GL/glut.h>
void renderScene(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// glBegin(GL_QUADS);
// glColor3f(1.0,0.0,0.0);
// glVertex2f(-0.5, 0.1); // Define vertices in counter-clockwise (CCW) order
// glVertex2f(-0.2, 0.1); // so that the normal (front-face) is facing you
// glVertex2f(-0.2, 0.5);
// glVertex2f(-0.5, 0.5);
// glEnd();
// glBegin(GL_LINES);
// glColor3f(1.0,0.0,0.0);
// // glVertex3f(-30.0,12.0,3.0);
// // glVertex3f(-22.0,12.0,3.0);
// // glVertex3f(-22.0,12.0,3.0);
// // glVertex3f(-22.0,37.0,3.0);
// // glVertex3f(-22.0,37.0,3.0);
// // glVertex3f(-30.0,37.0,3.0);
// // glVertex3f(-30.0,37.0,3.0);
// // glVertex3f(-30.0,12.0,3.0);
// // glVertex3f(30.0,12.0,3.0);
// // glVertex3f(22.0,12.0,3.0);
// // glVertex3f(22.0,12.0,3.0);
// // glVertex3f(22.0,37.0,3.0);
// // glVertex3f(22.0,37.0,3.0);
// // glVertex3f(30.0,37.0,3.0);
// // glVertex3f(30.0,37.0,3.0);
// // glVertex3f(30.0,12.0,3.0);
// glEnd();
glBegin(GL_TRIANGLES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glEnd();
}
int main(int argc, char **argv) {
// init GLUT and create Window
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(800,800);
glutInitWindowSize(800,800);
glutCreateWindow("Lighthouse3D - GLUT Tutorial");
// register callbacks
glutDisplayFunc(renderScene);
// enter GLUT event processing cycle
glutMainLoop();
return 1;
}