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