Mercurial > public > algo-animator
comparison main.c @ 2:ea3c427d922d
draw a weird filled rectangle
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Mon, 12 Jun 2023 18:45:30 +0100 |
parents | 6882194679b5 |
children | e4003f606e07 |
comparison
equal
deleted
inserted
replaced
1:d445f99d9b13 | 2:ea3c427d922d |
---|---|
5 #define HEIGHT 1080 | 5 #define HEIGHT 1080 |
6 #define WIDTH 1920 | 6 #define WIDTH 1920 |
7 | 7 |
8 | 8 |
9 void setup() { | 9 void setup() { |
10 | 10 |
11 // Set background dark | 11 // Set background dark |
12 glClearColor(0.0, 0.0, 0.0, 1.0); | 12 glClearColor(0.0, 0.0, 0.0, 1.0); |
13 | 13 |
14 // Set point color and size to 1 pixel | 14 // Set point color and size to 1 pixel |
15 glColor3f(0.0, 1.0, 0.0); | 15 glColor3f(0.0, 1.0, 0.0); |
16 glPointSize(5.0); | 16 glPointSize(5.0); |
17 | 17 |
18 // Matrix projection and reset with identity | 18 // Matrix projection and reset with identity |
19 glMatrixMode(GL_PROJECTION); | 19 glMatrixMode(GL_PROJECTION); |
20 glLoadIdentity(); | 20 glLoadIdentity(); |
21 | 21 |
22 // Set the coordinates to be used with the viewport | 22 // Set the coordinates to be used with the viewport |
23 gluOrtho2D(0, WIDTH, HEIGHT, 0); | 23 gluOrtho2D(-300, 300, 300, -300); |
24 | |
25 glMatrixMode(GL_MODELVIEW); | |
26 glLoadIdentity(); | |
27 | |
24 } | 28 } |
25 | 29 |
26 | 30 |
27 void display() { | 31 void display() { |
28 glClear(GL_COLOR_BUFFER_BIT); | 32 glClear(GL_COLOR_BUFFER_BIT); |
29 glBegin(GL_POINTS); | 33 glRectf(100.0f, 100.0f, 200.0f, 200.0f); |
30 glVertex2i(1920/2, 1080/2); | 34 // glVertex2i(1920/2, 1080/2); |
31 glEnd(); | |
32 glFlush(); | 35 glFlush(); |
33 } | 36 } |
34 | 37 |
35 | 38 |
36 int main(int argc, char** argv) { | 39 int main(int argc, char** argv) { |