Cleanup
[carla.git] / source / modules / dgl / OpenGL-include.hpp
blob4f4bb0c125a86b229052228b599ef29490c760fc
1 /*
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
30 #ifndef APIENTRY
31 # define APIENTRY __stdcall
32 #endif // APIENTRY
34 /* We need WINGDIAPI defined */
35 #ifndef WINGDIAPI
36 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
37 # define WINGDIAPI __declspec(dllimport)
38 # elif defined(__LCC__)
39 # define WINGDIAPI __stdcall
40 # else
41 # define WINGDIAPI extern
42 # endif
43 # define DGL_WINGDIAPI_DEFINED
44 #endif // WINGDIAPI
46 /* Some <GL/glu.h> files also need CALLBACK defined */
47 #ifndef CALLBACK
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
51 # else
52 # define CALLBACK
53 # endif
54 # else
55 # define CALLBACK __stdcall
56 # endif
57 # define DGL_CALLBACK_DEFINED
58 #endif // CALLBACK
60 #endif // DISTRHO_OS_WINDOWS
62 // --------------------------------------------------------------------------------------------------------------------
63 // OpenGL includes
65 #ifdef DISTRHO_OS_MAC
66 # ifdef DGL_USE_OPENGL3
67 # include <OpenGL/gl3.h>
68 # include <OpenGL/gl3ext.h>
69 # else
70 # include <OpenGL/gl.h>
71 # endif
72 #else
73 # ifndef DISTRHO_OS_WINDOWS
74 # define GL_GLEXT_PROTOTYPES
75 # endif
76 # ifndef __GLEW_H__
77 # include <GL/gl.h>
78 # include <GL/glext.h>
79 # endif
80 #endif
82 // --------------------------------------------------------------------------------------------------------------------
83 // Missing OpenGL defines
85 #if defined(GL_BGR_EXT) && !defined(GL_BGR)
86 # define GL_BGR GL_BGR_EXT
87 #endif
89 #if defined(GL_BGRA_EXT) && !defined(GL_BGRA)
90 # define GL_BGRA GL_BGRA_EXT
91 #endif
93 #ifndef GL_CLAMP_TO_BORDER
94 # define GL_CLAMP_TO_BORDER 0x812D
95 #endif
97 // --------------------------------------------------------------------------------------------------------------------
98 // Fix OpenGL includes for Windows, based on glfw code (part 2)
100 #ifdef DGL_CALLBACK_DEFINED
101 # undef CALLBACK
102 # undef DGL_CALLBACK_DEFINED
103 #endif
105 #ifdef DGL_WINGDIAPI_DEFINED
106 # undef WINGDIAPI
107 # undef DGL_WINGDIAPI_DEFINED
108 #endif
110 // --------------------------------------------------------------------------------------------------------------------
112 #endif