1 /*
2  * DISTRHO Plugin Framework (DPF)
3  * Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
4  *
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.
8  *
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.
15  */
16 
17 #ifndef DGL_OPENGL_HPP_INCLUDED
18 #define DGL_OPENGL_HPP_INCLUDED
19 
20 #include "ImageBase.hpp"
21 
22 // -----------------------------------------------------------------------
23 // Fix OpenGL includes for Windows, based on glfw code (part 1)
24 
25 #undef DGL_CALLBACK_DEFINED
26 #undef DGL_WINGDIAPI_DEFINED
27 
28 #ifdef DISTRHO_OS_WINDOWS
29 
30 #ifndef APIENTRY
31 # define APIENTRY __stdcall
32 #endif // APIENTRY
33 
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
45 
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
59 
60 /* Most GL/glu.h variants on Windows need wchar_t */
61 #include <cstddef>
62 
63 #endif // DISTRHO_OS_WINDOWS
64 
65 // -----------------------------------------------------------------------
66 // OpenGL includes
67 
68 #ifdef DISTRHO_OS_MAC
69 # include <OpenGL/gl.h>
70 #else
71 # ifndef DISTRHO_OS_WINDOWS
72 #  define GL_GLEXT_PROTOTYPES
73 # endif
74 # include <GL/gl.h>
75 # include <GL/glext.h>
76 #endif
77 
78 // -----------------------------------------------------------------------
79 // Missing OpenGL defines
80 
81 #if defined(GL_BGR_EXT) && !defined(GL_BGR)
82 # define GL_BGR GL_BGR_EXT
83 #endif
84 
85 #if defined(GL_BGRA_EXT) && !defined(GL_BGRA)
86 # define GL_BGRA GL_BGRA_EXT
87 #endif
88 
89 #ifndef GL_CLAMP_TO_BORDER
90 # define GL_CLAMP_TO_BORDER 0x812D
91 #endif
92 
93 // -----------------------------------------------------------------------
94 // Fix OpenGL includes for Windows, based on glfw code (part 2)
95 
96 #ifdef DGL_CALLBACK_DEFINED
97 # undef CALLBACK
98 # undef DGL_CALLBACK_DEFINED
99 #endif
100 
101 #ifdef DGL_WINGDIAPI_DEFINED
102 # undef WINGDIAPI
103 # undef DGL_WINGDIAPI_DEFINED
104 #endif
105 
106 START_NAMESPACE_DGL
107 
108 // -----------------------------------------------------------------------
109 
110 /**
111    Graphics context.
112  */
113 struct GraphicsContext
114 {
115 };
116 
117 // -----------------------------------------------------------------------
118 
119 END_NAMESPACE_DGL
120 
121 #endif
122