Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOMacroOpenGL.h
Go to the documentation of this file.
1/*
2
3OOMacroOpenGL.h
4
5Under Mac OS X, OpenGL performance can be improved somewhat by using macros
6that call through to a function table directly, avoiding calls to functions
7that just look up the current context and pass their parameters through to
8a context-specific implementation function.
9
10This header abstracts that behaviour for cross-platformity.
11
12Oolite
13Copyright (C) 2004-2013 Giles C Williams and contributors
14
15This program is free software; you can redistribute it and/or
16modify it under the terms of the GNU General Public License
17as published by the Free Software Foundation; either version 2
18of the License, or (at your option) any later version.
19
20This program is distributed in the hope that it will be useful,
21but WITHOUT ANY WARRANTY; without even the implied warranty of
22MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23GNU General Public License for more details.
24
25You should have received a copy of the GNU General Public License
26along with this program; if not, write to the Free Software
27Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
28MA 02110-1301, USA.
29
30*/
31
32#if OOLITE_MAC_OS_X && !defined(OOLITE_NO_CGL_MACRO)
33
34#if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
35
36#define CGL_MACRO_CACHE_RENDERER
37#import <OpenGL/CGLMacro.h>
38
39#define OO_ENTER_OPENGL CGL_MACRO_DECLARE_VARIABLES
40
41#else
42
43#import <OpenGL/CGLMacro.h>
44
45#define OO_ENTER_OPENGL() CGLContextObj CGL_MACRO_CONTEXT = CGLGetCurrentContext(); \
46
47#endif
48#else
49// Not OS X
50#define OO_ENTER_OPENGL() do {} while (0)
51#endif