goat3dgfx

view src/opengl.h @ 0:1873dfd13f2d

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 14 Nov 2013 05:27:09 +0200
parents
children 7d6b667821cf
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_