Line data Source code
1 0 : /* 2 : 3 : OOMacroOpenGL.h 4 : 5 : Under Mac OS X, OpenGL performance can be improved somewhat by using macros 6 : that call through to a function table directly, avoiding calls to functions 7 : that just look up the current context and pass their parameters through to 8 : a context-specific implementation function. 9 : 10 : This header abstracts that behaviour for cross-platformity. 11 : 12 : Oolite 13 : Copyright (C) 2004-2013 Giles C Williams and contributors 14 : 15 : This program is free software; you can redistribute it and/or 16 : modify it under the terms of the GNU General Public License 17 : as published by the Free Software Foundation; either version 2 18 : of the License, or (at your option) any later version. 19 : 20 : This program is distributed in the hope that it will be useful, 21 : but WITHOUT ANY WARRANTY; without even the implied warranty of 22 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 : GNU General Public License for more details. 24 : 25 : You should have received a copy of the GNU General Public License 26 : along with this program; if not, write to the Free Software 27 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 28 : MA 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 0 : #define OO_ENTER_OPENGL() do {} while (0) 51 : #endif