source: trunk/src/lolgl.h @ 960

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

osx: link with the proper OpenGL libraries on OS X.

  • Property svn:keywords set to Id
File size: 1.8 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://sam.zoy.org/projects/COPYING.WTFPL 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/* Only define one GL platform */
22#if defined HAVE_GL_2X
23#   undef HAVE_GLES_2X
24#endif
25
26/* Include GL development headers.
27 * Do not include glew.h on OS X, because the version shipped with Fink
28 * links with X11 whereas we want the system’s Cocoa-friendly GL libs. */
29#if defined USE_GLEW && !defined __APPLE__
30#   include <glew.h>
31#elif defined HAVE_GL_2X
32#   if defined __APPLE__ && defined __MACH__ && defined __arm__
33#       include <OpenGL/gl.h>
34#   elif defined __APPLE__ && defined __MACH__
35#       define MACOS_OPENGL
36#       define GL_GLEXT_PROTOTYPES
37#       include <OpenGL/OpenGL.h>
38#       include <OpenGL/gl.h>
39#       include <OpenGL/glext.h>
40#   else
41#       define GL_GLEXT_PROTOTYPES
42#       include <GL/gl.h>
43#   endif
44#elif defined HAVE_GLES_2X
45#   if defined __APPLE__ && defined __MACH__
46#       include <OpenGLES/ES2/gl.h>
47#       include <OpenGLES/ES2/glext.h>
48#   elif defined __CELLOS_LV2__
49#       include <PSGL/psgl.h>
50#       include <PSGL/psglu.h>
51#   else
52#       include <GLES2/gl2.h>
53#       include <GLES2/gl2ext.h>
54#   endif
55#endif
56
57/* Redefine some function names */
58#if defined HAVE_GL_2X
59#elif defined HAVE_GLES_2X
60#   define glClearDepth glClearDepthf
61#   define glGenVertexArrays glGenVertexArraysOES
62#   define glDeleteVertexArrays glDeleteVertexArraysOES
63#   define glBindVertexArray glBindVertexArrayOES
64#endif
65
66#endif // __LOL_LOLGL_H__
67
Note: See TracBrowser for help on using the repository browser.