]> git.sesse.net Git - movit/blob - util.h
Fix indenting in effect_id.h.
[movit] / util.h
1 #ifndef _UTIL_H
2 #define _UTIL_H 1
3
4 #include <stdio.h>
5 #include <stdlib.h>
6
7 #include <string>
8
9 #include <GL/gl.h>
10
11 #define BUFFER_OFFSET(i) ((char *)NULL + (i))
12
13 // assumes h in [0, 2pi> or [-pi, pi>
14 void hsv2rgb(float h, float s, float v, float *r, float *g, float *b);
15
16 // Column major (same as OpenGL).
17 typedef double Matrix3x3[9];
18
19 std::string read_file(const std::string &filename);
20 GLuint compile_shader(const std::string &shader_src, GLenum type);
21 void multiply_3x3_matrices(const Matrix3x3 a, const Matrix3x3 b, Matrix3x3 result);
22 void invert_3x3_matrix(const Matrix3x3 m, Matrix3x3 result);
23 void print_3x3_matrix(const Matrix3x3 m);
24
25 #ifdef NDEBUG
26 #define check_error()
27 #else
28 #define check_error() { int err = glGetError(); if (err != GL_NO_ERROR) { printf("GL error 0x%x at %s:%d\n", err, __FILE__, __LINE__); exit(1); } }
29 #endif
30
31 #endif // !defined(_UTIL_H)