0
|
1 #include <stdio.h>
|
|
2 #include <GL/glut.h>
|
|
3
|
|
4
|
|
5 #define HEIGHT 1080
|
|
6 #define WIDTH 1920
|
|
7
|
|
8
|
|
9 void setup() {
|
|
10
|
|
11 // Set background dark
|
|
12 glClearColor(0.0, 0.0, 0.0, 1.0);
|
|
13
|
|
14 // Set point color and size to 1 pixel
|
|
15 glColor3f(0.0, 1.0, 0.0);
|
|
16 glPointSize(5.0);
|
|
17
|
|
18 // Matrix projection and reset with identity
|
|
19 glMatrixMode(GL_PROJECTION);
|
|
20 glLoadIdentity();
|
|
21
|
|
22 // Set the coordinates to be used with the viewport
|
|
23 gluOrtho2D(0, WIDTH, HEIGHT, 0);
|
|
24 }
|
|
25
|
|
26
|
|
27 void display() {
|
|
28 glClear(GL_COLOR_BUFFER_BIT);
|
|
29 glBegin(GL_POINTS);
|
|
30 glVertex2i(1920/2, 1080/2);
|
|
31 glEnd();
|
|
32 glFlush();
|
|
33 }
|
|
34
|
|
35
|
|
36 int main(int argc, char** argv) {
|
|
37 glutInit(&argc, argv);
|
|
38 glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
|
|
39 glutInitWindowSize(WIDTH, HEIGHT);
|
|
40 glutCreateWindow("OpenGL Window");
|
|
41 setup();
|
|
42 glutDisplayFunc(display);
|
|
43 glutMainLoop();
|
|
44
|
|
45 return 0;
|
|
46 }
|