source: trunk/src/lolgl.h @ 2792

Last change on this file since 2792 was 2792, checked in by sam, 8 years ago

gpu: add a 16-bit depth buffer to framebuffers on WebGL and GL ES.

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://www.wtfpl.net/ for more details.
9//
10
11//
12// The GL support
13// --------------
14//
15
16#if !defined __LOL_LOLGL_H__
17#define __LOL_LOLGL_H__
18
19#define GL_GLEXT_PROTOTYPES
20
21/* Prefer GLES on browsers */
22#if defined EMSCRIPTEN
23#   undef HAVE_GL_2X
24#endif
25
26/* Only define one GL platform */
27#if defined HAVE_GL_2X
28#   undef HAVE_GLES_2X
29#endif
30
31/* Include GL development headers.
32 * Do not include glew.h on OS X, because the version shipped with Fink
33 * links with X11 whereas we want the system’s Cocoa-friendly GL libs. */
34#if defined USE_GLEW && !defined __APPLE__
35#   include <glew.h>
36#elif defined HAVE_GL_2X
37#   if defined __APPLE__ && defined __MACH__ && defined __arm__
38#       include <OpenGL/gl.h>
39#   elif defined __APPLE__ && defined __MACH__
40#       define MACOS_OPENGL
41#       define GL_GLEXT_PROTOTYPES
42#       include <OpenGL/OpenGL.h>
43#       include <OpenGL/gl.h>
44#       include <OpenGL/glext.h>
45#   else
46#       define GL_GLEXT_PROTOTYPES
47#       include <GL/gl.h>
48#   endif
49#elif defined HAVE_GLES_2X
50#   if defined __APPLE__ && defined __MACH__
51#       include <OpenGLES/ES2/gl.h>
52#       include <OpenGLES/ES2/glext.h>
53#   elif defined __CELLOS_LV2__
54#       include <PSGL/psgl.h>
55#       include <PSGL/psglu.h>
56#   else
57#       include <GLES2/gl2.h>
58#       include <GLES2/gl2ext.h>
59#   endif
60#endif
61
62#define LOL_CHECK_GLERROR() \
63    { \
64        GLenum error = glGetError(); \
65        ASSERT(error == GL_NO_ERROR, "OpenGL error: 0x%04x\n", error); \
66    }
67
68#endif // __LOL_LOLGL_H__
69
Note: See TracBrowser for help on using the repository browser.