vrshoot
view src/opengl.h @ 1:e7ca128b8713
looks nice :)
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 02 Feb 2014 00:35:22 +0200 |
parents | |
children |
line source
1 #ifndef OPENGL_H_
2 #define OPENGL_H_
4 #include <stdlib.h>
6 #ifdef __APPLE__
7 #include "TargetConditionals.h"
9 #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
10 /* iOS */
11 #include <OpenGLES/ES2/gl.h>
12 #include <OpenGLES/ES2/glext.h>
14 #define GL_CLAMP GL_CLAMP_TO_EDGE
15 #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
17 #undef USE_OLDGL
19 #define GL_WRITE_ONLY GL_WRITE_ONLY_OES
20 #define glMapBuffer glMapBufferOES
21 #define glUnmapBuffer glUnmapBufferOES
23 #else
24 /* MacOS X */
25 #include <GL/glew.h>
26 #include <GLUT/glut.h>
28 #define USE_OLDGL
29 #endif
31 #else
32 /* UNIX or Windows */
33 #include <GL/glew.h>
34 #include <GL/glut.h>
36 #define USE_OLDGL
37 #endif
39 #ifndef GL_RGB16F
40 #define GL_RGB16F 0x881b
41 #endif
42 #ifndef GL_RGBA16F
43 #define GL_RGBA16F 0x881a
44 #endif
45 #ifndef GL_RGB32F
46 #define GL_RGB32F 0x8815
47 #endif
48 #ifndef GL_RGBA32F
49 #define GL_RGBA32F 0x8814
50 #endif
51 #ifndef GL_LUMINANCE16F
52 #define GL_LUMINANCE16F 0x881e
53 #endif
54 #ifndef GL_LUMINANCE32F
55 #define GL_LUMINANCE32F 0x8818
56 #endif
58 #define CHECKGLERR \
59 do { \
60 int err = glGetError(); \
61 if(err) { \
62 fprintf(stderr, "%s:%d: OpenGL error 0x%x: %s\n", __FILE__, __LINE__, err, strglerr(err)); \
63 abort(); \
64 } \
65 } while(0)
67 void init_opengl();
69 const char *strglerr(int err);
71 #endif // OPENGL_H_