Oolite
Loading...
Searching...
No Matches
OOOpenGLOnly.h
Go to the documentation of this file.
1/*
2
3OOOpenGL.h
4
5Do whatever is appropriate to get gl.h, glu.h and glext.h included.
6
7
8Oolite
9Copyright (C) 2004-2013 Giles C Williams and contributors
10
11This program is free software; you can redistribute it and/or
12modify it under the terms of the GNU General Public License
13as published by the Free Software Foundation; either version 2
14of the License, or (at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with this program; if not, write to the Free Software
23Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24MA 02110-1301, USA.
25
26*/
27
28#pragma once
29// SDL OpenGL includes...
30
31// GL_GLEXT_PROTOTYPES must be defined for the Linux and macOS builds to use shaders.
32#if OOLITE_LINUX || defined(__APPLE__)
33#ifndef GL_GLEXT_PROTOTYPES
34#define GL_GLEXT_PROTOTYPES
35#define __DEFINED_GL_GLEXT_PROTOTYPES
36#endif // GL_GLEXT_PROTOTYPES
37#endif // OOLITE_LINUX && !OOLITE_WINDOWS
38
39// the standard SDL_opengl.h
40#include <SDL3/SDL_opengl.h>
41
42// include an up-to-date version of glext.h
43#ifdef __APPLE__
44#include <OpenGL/glext.h>
45#include <OpenGL/glu.h>
46#else
47#include <GL/glext.h>
48#include <GL/glu.h>
49#endif
50
51#ifdef __APPLE__
52/* The macOS legacy (2.1) context provides the GL 3.x features Oolite uses
53 through extensions. Map the core names onto them.
54 */
55#define glGenVertexArrays glGenVertexArraysAPPLE
56#define glBindVertexArray glBindVertexArrayAPPLE
57#define glDeleteVertexArrays glDeleteVertexArraysAPPLE
58#define glClampColor glClampColorARB
59#define OO_MSAA_COLOR_RENDERBUFFER 1
60#else
61#define OO_MSAA_COLOR_RENDERBUFFER 0
62#endif
63
64#ifdef __DEFINED_GL_GLEXT_PROTOTYPES
65#undef GL_GLEXT_PROTOTYPES
66#undef __DEFINED_GL_GLEXT_PROTOTYPES
67#endif