This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
glutil.h
105 lines (86 loc) · 2.27 KB
/
glutil.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef __GLUTIL_H__
#define __GLUTIL_H__
#include <stdlib.h>
#if defined(__APPLE_CC__)
#include <stdbool.h>
#include <OpenGL/gl3.h>
#endif //__APPLE_CC__
#ifdef _WIN32
#include <GL/glew.h>
typedef unsigned char bool;
#define true 1
#define false 0
#endif //_WIN32
#ifdef __linux__
#include <GL/gl.h>
typedef unsigned char bool;
#define true 1
#define false 0
#endif //__linux__
#define PI (3.1415926f)
typedef GLfloat glfloat;
typedef GLuint glpid;
typedef GLuint glshader;
typedef GLuint glshader_type;
typedef GLint glbool;
typedef char glchar;
typedef GLuint glvao;
typedef GLuint glvbo;
typedef GLint gllocation;
typedef const GLfloat glconst_float;
typedef int glangle;
typedef struct _glvec3 {
glfloat x;
glfloat y;
glfloat z;
} glvec3;
typedef struct _glvec4 {
glfloat x;
glfloat y;
glfloat z;
glfloat w;
} glvec4;
typedef struct _glmat4 {
glfloat vecs[16];
} glmat4;
typedef struct _glvector {
size_t size;
size_t total;
glfloat vec[0];
} glvector;
typedef struct _glprograme {
glpid pid;
glshader vid;
glshader fid;
} glprograme;
void glset_vec3(glvec3 *, glfloat, glfloat, glfloat);
void glassign_vec3(glvec3 *, glvec3 *);
glvector * glalloc_vector();
void glfree_vector(glvector *);
size_t glget_vector_size(glvector *);
glfloat * glget_vector_array(glvector *);
void glpush_vector(glvector * *, glfloat);
void glpush_vec3(glvector * *, glvec3 *);
void glpush_2vec3(glvector * *, glvec3 *, glvec3 *);
void glprint_vector(glvector * v);
void glappend_vector(glvector * *, glvector *);
glprograme * glalloc_programe();
bool glcreate_programe(glprograme *, const glchar *, const glchar *);
void glfree_programe(glprograme *);
glmat4 * glalloc_mat4();
void glfree_mat4(glmat4 *);
void glset_identify_mat4(glmat4 *);
glmat4 * glcreate_identify_mat4();
void glscale_mat4(glmat4 *, glvec3 *);
void glrotatefz_mat4(glmat4 *, glfloat);
void glrotatez_mat4(glmat4 *, glangle);
void glmove_mat4(glmat4 *, glvec3 *);
void glmvtrans_mat4(glmat4 *, glfloat, glfloat);
glfloat * glget_mat4_array(glmat4 *);
void glmutiply_mat4(glmat4 *, glmat4 *);
void glassign_mat4(glmat4 *, glmat4 *);
void glmutiply_scale_mat4(glmat4 *, glvec3 *);
void glmutiply_rotatez_mat4(glmat4 *, glfloat);
void glmutiply_move_mat4(glmat4 *, glvec3 *);
glfloat glang_transform(unsigned int);
#endif //__GLUTIL_H__