Merge r11677:11678 from trunk into the Qt branch: add a platform-abstraction header: `opengl.h`

Add a header to allow platform-indepent inclusion of the OpenGL API,
removing our dependency on SDL_opengl.h and consolidating
platform-specific code in that single header.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/branches/qt-trunk@11679 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2010-09-17 10:34:35 +00:00 committed by Git SVN Gateway
parent 3f296e5cf7
commit a83560844c
4 changed files with 58 additions and 8 deletions

48
lib/framework/opengl.h Normal file
View File

@ -0,0 +1,48 @@
/*
This file is part of Warzone 2100.
Copyright (C) 2010 Giel van Schijndel
Copyright (C) 2010 Warzone 2100 Project
Warzone 2100 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Warzone 2100 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/** @file
* @brief Platform independent OpenGL inclusion.
*/
#ifndef __INCLUDED_LIB_FRAMEWORK_OPENGL_H__
#define __INCLUDED_LIB_FRAMEWORK_OPENGL_H__
#include "wzglobal.h"
#if defined(__glext_h_)
# define FRAMEWORK_GLEXT_INCLUDED
#else
// Prevent inclusion of glext.h by gl.h, requiring explicit inclusion by the user
# define __glext_h_
#endif
#if defined(WZ_OS_MAC)
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif
#if defined(FRAMEWORK_GLEXT_INCLUDED)
# undef FRAMEWORK_GLEXT_INCLUDED
#else
# undef __glext_h_
#endif
#endif

View File

@ -20,12 +20,7 @@
#ifndef _tex_
#define _tex_
//#include <GLee.h>
#if defined __APPLE__ && defined __MACH__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include "lib/framework/opengl.h"
#include "png_util.h"
#ifdef __cplusplus

View File

@ -30,6 +30,13 @@
#include "lib/framework/frame.h"
#include <physfs.h>
#include "lib/framework/opengl.h"
#if defined(WZ_OS_MAC)
# include <OpenGL/glu.h>
#else
# include <GL/glu.h>
#endif
#include "lib/ivis_common/piestate.h"
#include "lib/ivis_common/piedef.h"

View File

@ -22,9 +22,9 @@
#include "lib/framework/frame.h"
#if defined(WZ_OS_MAC)
#include <OpenGL/glu.h>
# include <OpenGL/glu.h>
#else
#include <GL/glu.h>
# include <GL/glu.h>
#endif
#include "lib/ivis_common/ivisdef.h"