17 #ifndef DGL_OPENGL_HPP_INCLUDED
18 #define DGL_OPENGL_HPP_INCLUDED
20 #include "ImageBase.hpp"
21 #include "ImageBaseWidgets.hpp"
26 #undef DGL_CALLBACK_DEFINED
27 #undef DGL_WINGDIAPI_DEFINED
29 #ifdef DISTRHO_OS_WINDOWS
32 # define APIENTRY __stdcall
37 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
38 # define WINGDIAPI __declspec(dllimport)
39 # elif defined(__LCC__)
40 # define WINGDIAPI __stdcall
42 # define WINGDIAPI extern
44 # define DGL_WINGDIAPI_DEFINED
49 # if defined(_MSC_VER)
50 # if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
51 # define CALLBACK __stdcall
56 # define CALLBACK __stdcall
58 # define DGL_CALLBACK_DEFINED
64 #endif // DISTRHO_OS_WINDOWS
70 # ifdef DGL_USE_OPENGL3
71 # include <OpenGL/gl3.h>
72 # include <OpenGL/gl3ext.h>
74 # include <OpenGL/gl.h>
77 # ifndef DISTRHO_OS_WINDOWS
78 # define GL_GLEXT_PROTOTYPES
82 # include <GL/glext.h>
89 #if defined(GL_BGR_EXT) && !defined(GL_BGR)
90 # define GL_BGR GL_BGR_EXT
93 #if defined(GL_BGRA_EXT) && !defined(GL_BGRA)
94 # define GL_BGRA GL_BGRA_EXT
97 #ifndef GL_CLAMP_TO_BORDER
98 # define GL_CLAMP_TO_BORDER 0x812D
104 #ifdef DGL_CALLBACK_DEFINED
106 # undef DGL_CALLBACK_DEFINED
109 #ifdef DGL_WINGDIAPI_DEFINED
111 # undef DGL_WINGDIAPI_DEFINED
128 ImageFormat asDISTRHOImageFormat(
const GLenum format)
133 return kImageFormatGrayscale;
135 return kImageFormatBGR;
137 return kImageFormatBGRA;
139 return kImageFormatRGB;
141 return kImageFormatRGBA;
144 return kImageFormatNull;
148 GLenum asOpenGLImageFormat(
const ImageFormat format)
152 case kImageFormatNull:
154 case kImageFormatGrayscale:
156 case kImageFormatBGR:
158 case kImageFormatBGRA:
160 case kImageFormatRGB:
162 case kImageFormatRGBA:
195 OpenGLImage(
const char* rawData, uint width, uint height, ImageFormat format = kImageFormatBGRA);
219 ImageFormat format = kImageFormatBGRA) noexcept
override;
232 inline void loadFromMemory(
const char* rdata, uint w, uint h, ImageFormat fmt = kImageFormatBGRA)
244 DISTRHO_DEPRECATED_BY(
"OpenGLImage(const char*, uint, uint, ImageFormat)")
245 explicit OpenGLImage(
const char* rawData, uint width, uint height, GLenum glFormat);
252 DISTRHO_DEPRECATED_BY(
"OpenGLImage(const char*, const Size<uint>&, ImageFormat)")
259 DISTRHO_DEPRECATED_BY(
"draw(const GraphicsContext&)")
266 DISTRHO_DEPRECATED_BY(
"drawAt(const GraphicsContext&, int, int)")
267 void drawAt(
int x,
int y);
273 DISTRHO_DEPRECATED_BY(
"drawAt(const GraphicsContext&, const Point<int>&)")
281 GLenum
getType() const noexcept {
return GL_UNSIGNED_BYTE; }