vrshoot
diff src/opengl.h @ 0:b2f14e535253
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 01 Feb 2014 19:58:19 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/opengl.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,71 @@ 1.4 +#ifndef OPENGL_H_ 1.5 +#define OPENGL_H_ 1.6 + 1.7 +#include <stdlib.h> 1.8 + 1.9 +#ifdef __APPLE__ 1.10 +#include "TargetConditionals.h" 1.11 + 1.12 +#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR 1.13 +/* iOS */ 1.14 +#include <OpenGLES/ES2/gl.h> 1.15 +#include <OpenGLES/ES2/glext.h> 1.16 + 1.17 +#define GL_CLAMP GL_CLAMP_TO_EDGE 1.18 +#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES 1.19 + 1.20 +#undef USE_OLDGL 1.21 + 1.22 +#define GL_WRITE_ONLY GL_WRITE_ONLY_OES 1.23 +#define glMapBuffer glMapBufferOES 1.24 +#define glUnmapBuffer glUnmapBufferOES 1.25 + 1.26 +#else 1.27 +/* MacOS X */ 1.28 +#include <GL/glew.h> 1.29 +#include <GLUT/glut.h> 1.30 + 1.31 +#define USE_OLDGL 1.32 +#endif 1.33 + 1.34 +#else 1.35 +/* UNIX or Windows */ 1.36 +#include <GL/glew.h> 1.37 +#include <GL/glut.h> 1.38 + 1.39 +#define USE_OLDGL 1.40 +#endif 1.41 + 1.42 +#ifndef GL_RGB16F 1.43 +#define GL_RGB16F 0x881b 1.44 +#endif 1.45 +#ifndef GL_RGBA16F 1.46 +#define GL_RGBA16F 0x881a 1.47 +#endif 1.48 +#ifndef GL_RGB32F 1.49 +#define GL_RGB32F 0x8815 1.50 +#endif 1.51 +#ifndef GL_RGBA32F 1.52 +#define GL_RGBA32F 0x8814 1.53 +#endif 1.54 +#ifndef GL_LUMINANCE16F 1.55 +#define GL_LUMINANCE16F 0x881e 1.56 +#endif 1.57 +#ifndef GL_LUMINANCE32F 1.58 +#define GL_LUMINANCE32F 0x8818 1.59 +#endif 1.60 + 1.61 +#define CHECKGLERR \ 1.62 + do { \ 1.63 + int err = glGetError(); \ 1.64 + if(err) { \ 1.65 + fprintf(stderr, "%s:%d: OpenGL error 0x%x: %s\n", __FILE__, __LINE__, err, strglerr(err)); \ 1.66 + abort(); \ 1.67 + } \ 1.68 + } while(0) 1.69 + 1.70 +void init_opengl(); 1.71 + 1.72 +const char *strglerr(int err); 1.73 + 1.74 +#endif // OPENGL_H_