-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathArduinoGL.h
65 lines (51 loc) · 1.58 KB
/
ArduinoGL.h
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
/*
ArduinoGL.h - OpenGL subset for Arduino.
Created by Fabio de Albuquerque Dela Antonio
fabio914 at gmail.com
*/
#ifndef ArduinoGL_h
#define ArduinoGL_h
#include "Arduino.h"
#include "Canvas.h"
typedef enum {
GL_NONE = 0,
GL_POINTS,
GL_POLYGON,
GL_TRIANGLE_STRIP
} GLDrawMode;
typedef enum {
GL_PROJECTION = 0,
GL_MODELVIEW
} GLMatrixMode;
/* Masks */
#define GL_COLOR_BUFFER_BIT 0x1
typedef struct {
float x, y, z, w;
} GLVertex;
/* Matrices */
void glMatrixMode(GLMatrixMode mode);
void glMultMatrixf(float * m);
void glLoadMatrixf(float * m);
void glLoadIdentity(void);
void glPushMatrix(void);
void glPopMatrix(void);
void glOrtho(float left, float right, float bottom, float top, float zNear, float zFar);
void gluOrtho2D(float left, float right, float bottom, float top);
void glFrustum(float left, float right, float bottom, float top, float zNear, float zFar);
void gluPerspective(float fovy, float aspect, float zNear, float zFar);
void glRotatef(float angle, float x, float y, float z);
void glTranslatef(float x, float y, float z);
void glScalef(float x, float y, float z);
void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ);
/* Vertices */
void glVertex4fv(float * v);
void glVertex4f(float x, float y, float z, float w);
void glVertex3fv(float * v);
void glVertex3f(float x, float y, float z);
/* OpenGL */
void glUseCanvas(Canvas * c); /* <-- Arduino only */
void glPointSize(unsigned size);
void glClear(int mask);
void glBegin(GLDrawMode mode);
void glEnd(void);
#endif