# HG changeset patch # User Dennis C. M. # Date 1686590659 -3600 # Node ID 6882194679b5b0fd5527f49dd09976372e5d24b7 draw a point diff -r 000000000000 -r 6882194679b5 a.out Binary file a.out has changed diff -r 000000000000 -r 6882194679b5 main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.c Mon Jun 12 18:24:19 2023 +0100 @@ -0,0 +1,46 @@ +#include +#include + + +#define HEIGHT 1080 +#define WIDTH 1920 + + +void setup() { + + // Set background dark + glClearColor(0.0, 0.0, 0.0, 1.0); + + // Set point color and size to 1 pixel + glColor3f(0.0, 1.0, 0.0); + glPointSize(5.0); + + // Matrix projection and reset with identity + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + // Set the coordinates to be used with the viewport + gluOrtho2D(0, WIDTH, HEIGHT, 0); +} + + +void display() { + glClear(GL_COLOR_BUFFER_BIT); + glBegin(GL_POINTS); + glVertex2i(1920/2, 1080/2); + glEnd(); + glFlush(); +} + + +int main(int argc, char** argv) { + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); + glutInitWindowSize(WIDTH, HEIGHT); + glutCreateWindow("OpenGL Window"); + setup(); + glutDisplayFunc(display); + glutMainLoop(); + + return 0; +}