2 * DISTRHO Plugin Framework (DPF)
3 * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
5 * Permission to use, copy, modify, and/or distribute this software for any purpose with
6 * or without fee is hereby granted, provided that the above copyright notice and this
7 * permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
10 * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
11 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifndef DGL_OPENGL_INCLUDE_HPP_INCLUDED
18 #define DGL_OPENGL_INCLUDE_HPP_INCLUDED
20 #include "../distrho/src/DistrhoDefines.h"
22 // --------------------------------------------------------------------------------------------------------------------
23 // Fix OpenGL includes for Windows, based on glfw code (part 1)
25 #undef DGL_CALLBACK_DEFINED
26 #undef DGL_WINGDIAPI_DEFINED
28 #ifdef DISTRHO_OS_WINDOWS
31 # define APIENTRY __stdcall
34 /* We need WINGDIAPI defined */
36 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
37 # define WINGDIAPI __declspec(dllimport)
38 # elif defined(__LCC__)
39 # define WINGDIAPI __stdcall
41 # define WINGDIAPI extern
43 # define DGL_WINGDIAPI_DEFINED
46 /* Some <GL/glu.h> files also need CALLBACK defined */
48 # if defined(_MSC_VER)
49 # if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
50 # define CALLBACK __stdcall
55 # define CALLBACK __stdcall
57 # define DGL_CALLBACK_DEFINED
60 #endif // DISTRHO_OS_WINDOWS
62 // --------------------------------------------------------------------------------------------------------------------
66 # ifdef DGL_USE_OPENGL3
67 # include <OpenGL/gl3.h>
68 # include <OpenGL/gl3ext.h>
70 # include <OpenGL/gl.h>
73 # ifndef DISTRHO_OS_WINDOWS
74 # define GL_GLEXT_PROTOTYPES
78 # include <GL/glext.h>
82 // --------------------------------------------------------------------------------------------------------------------
83 // Missing OpenGL defines
85 #if defined(GL_BGR_EXT) && !defined(GL_BGR)
86 # define GL_BGR GL_BGR_EXT
89 #if defined(GL_BGRA_EXT) && !defined(GL_BGRA)
90 # define GL_BGRA GL_BGRA_EXT
93 #ifndef GL_CLAMP_TO_BORDER
94 # define GL_CLAMP_TO_BORDER 0x812D
97 // --------------------------------------------------------------------------------------------------------------------
98 // Fix OpenGL includes for Windows, based on glfw code (part 2)
100 #ifdef DGL_CALLBACK_DEFINED
102 # undef DGL_CALLBACK_DEFINED
105 #ifdef DGL_WINGDIAPI_DEFINED
107 # undef DGL_WINGDIAPI_DEFINED
110 // --------------------------------------------------------------------------------------------------------------------