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