include/SDL_opengl.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 15 Jun 2014 17:37:35 -0700
changeset 8868 55b16e3a3fc4
parent 8825 0cb64df3fa28
child 9088 c94127dcbe97
permissions -rw-r--r--
Fixed bug 2568 - NO_SDL_GLEXT should prevent OS glext.h as well

Jørgen Tjernø

If you #define NO_SDL_GLEXT before including SDL_opengl.h, it still includes the platform-provided glext.h. The comments indicate that this define is intended to be used when you provide your own glext.h (quote from SDL_opengl.h: "Define this if you have your own version of glext.h and want to disable the version included in SDL_opengl.h.")

This is a problem because glext.h depends on the contents of gl.h, and it's practical to let SDL_opengl.h pick the right #include for gl.h for our platform.
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /**
    23  *  \file SDL_opengl.h
    24  *
    25  *  This is a simple file to encapsulate the OpenGL API headers.
    26  */
    27 
    28 #ifndef _SDL_opengl_h
    29 #define _SDL_opengl_h
    30 
    31 #include "SDL_config.h"
    32 
    33 #ifndef __IPHONEOS__
    34 
    35 #ifdef __WIN32__
    36 #ifndef WIN32_LEAN_AND_MEAN
    37 #define WIN32_LEAN_AND_MEAN
    38 #endif
    39 #ifndef NOMINMAX
    40 #define NOMINMAX                /* Don't defined min() and max() */
    41 #endif
    42 #include <windows.h>
    43 #endif
    44 
    45 #ifdef __glext_h_
    46 /* Someone has already included glext.h */
    47 #define NO_SDL_GLEXT
    48 #else
    49 #define _SDL_CLEAR_GLEXT_HEADERGUARD
    50 #define __glext_h_              /* Don't let gl.h include glext.h */
    51 #endif
    52 #if defined(__MACOSX__)
    53 #include <OpenGL/gl.h>          /* Header File For The OpenGL Library */
    54 #define __X_GL_H
    55 #else
    56 #include <GL/gl.h>              /* Header File For The OpenGL Library */
    57 #endif
    58 #ifdef _SDL_CLEAR_GLEXT_HEADERGUARD
    59 #undef __glext_h_
    60 #endif
    61 
    62 /**
    63  *  \file SDL_opengl.h
    64  *
    65  *  This file is included because glext.h is not available on some systems.
    66  *  If you don't want this version included, simply define ::NO_SDL_GLEXT.
    67  *
    68  *  The latest version is available from:
    69  *      http://www.opengl.org/registry/
    70  */
    71 
    72 /**
    73  *  \def NO_SDL_GLEXT
    74  *
    75  *  Define this if you have your own version of glext.h and want to disable the
    76  *  version included in SDL_opengl.h.
    77  */
    78 
    79 #if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
    80 #include "SDL_opengl_glext.h"
    81 #endif /* NO_SDL_GLEXT */
    82 
    83 #endif /* !__IPHONEOS__ */
    84 
    85 #endif /* _SDL_opengl_h */
    86 
    87 /* vi: set ts=4 sw=4 expandtab: */