forked from rogerdahl/ws2812b-neopixel-emulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
69 lines (60 loc) · 1.43 KB
/
main.cpp
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
64
65
66
67
68
69
#include <string.h>
#include <inttypes.h>
#include <stdio.h>
#include <GL/freeglut.h>
#define u8 uint8_t
// arduino_sketch needs these.
#define u8 uint8_t
#define u16 uint16_t
#define u32 uint32_t
#define s16 int16_t
#include <Adafruit_NeoPixel.h>
#include "arduino_sketch.hpp"
//void display(void)
//{
// glClear(GL_COLOR_BUFFER_BIT);
// drawLedRing(500, 500, 24, 50);
//}
void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, w, h, 0);
glMatrixMode(GL_MODELVIEW);
}
void tick(void)
{
// Run the sketch loop.
loop();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(
GLUT_DOUBLE // double buffering
| GLUT_RGB // no alpha channel
);
glutInitWindowSize(1000, 1000);
glutCreateWindow("NeoPixel Emulator");
glClearColor(0.0, 0.0, 0.0, 1.0);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glColor3f(1.0f, 1.0f, 0.0f);
//glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutIdleFunc(tick);
// Run the sketch setup.
setup();
for (;;) {
// Run the sketch loop.
loop();
}
return 0;
}