| @@ -31,7 +31,7 @@ ImageFormat asDISTRHOImageFormat(const GLenum format) | |||||
| { | { | ||||
| switch (format) | switch (format) | ||||
| { | { | ||||
| #if defined(DGL_USE_OPENGL3) && !defined(DGL_USE_GLES2) | |||||
| #if defined(DGL_USE_OPENGL3) | |||||
| case GL_RED: | case GL_RED: | ||||
| #else | #else | ||||
| case GL_LUMINANCE: | case GL_LUMINANCE: | ||||
| @@ -58,7 +58,7 @@ GLenum asOpenGLImageFormat(const ImageFormat format) | |||||
| case kImageFormatNull: | case kImageFormatNull: | ||||
| break; | break; | ||||
| case kImageFormatGrayscale: | case kImageFormatGrayscale: | ||||
| #if defined(DGL_USE_OPENGL3) && !defined(DGL_USE_GLES2) | |||||
| #if defined(DGL_USE_OPENGL3) | |||||
| return GL_RED; | return GL_RED; | ||||
| #else | #else | ||||
| return GL_LUMINANCE; | return GL_LUMINANCE; | ||||
| @@ -89,6 +89,8 @@ DGL_EXT(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding) | |||||
| //#define STB_IMAGE_STATIC | //#define STB_IMAGE_STATIC | ||||
| #if defined(DGL_USE_GLES2) | #if defined(DGL_USE_GLES2) | ||||
| # define NANOVG_GLES2_IMPLEMENTATION | # define NANOVG_GLES2_IMPLEMENTATION | ||||
| #elif defined(DGL_USE_GLES3) | |||||
| # define NANOVG_GLES3_IMPLEMENTATION | |||||
| #elif defined(DGL_USE_OPENGL3) | #elif defined(DGL_USE_OPENGL3) | ||||
| # define NANOVG_GL3_IMPLEMENTATION | # define NANOVG_GL3_IMPLEMENTATION | ||||
| #else | #else | ||||
| @@ -48,6 +48,15 @@ START_NAMESPACE_DGL | |||||
| #if defined(DGL_USE_GLES2) && defined(DGL_USE_GLES3) | #if defined(DGL_USE_GLES2) && defined(DGL_USE_GLES3) | ||||
| # error Build config error, both GLESv2 and GLESv3 requested at the same time | # error Build config error, both GLESv2 and GLESv3 requested at the same time | ||||
| #endif | #endif | ||||
| #if defined(DGL_USE_GLES2) && !defined(DGL_USE_GLES) | |||||
| # error Build config error, DGL_USE_GLES2 is defined but DGL_USE_GLES is not | |||||
| #endif | |||||
| #if defined(DGL_USE_GLES3) && !defined(DGL_USE_GLES) | |||||
| # error Build config error, DGL_USE_GLES3 is defined but DGL_USE_GLES is not | |||||
| #endif | |||||
| #if defined(DGL_USE_GLES) && !(defined(DGL_USE_GLES2) || defined(DGL_USE_GLES3)) | |||||
| # error Build config error, DGL_USE_GLES is defined which requires either DGL_USE_GLES2 or DGL_USE_GLES3 | |||||
| #endif | |||||
| // -------------------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -384,7 +393,7 @@ static void setupOpenGLImage(const OpenGLImage& image, GLuint textureId) | |||||
| intformat = GL_RGB; | intformat = GL_RGB; | ||||
| break; | break; | ||||
| case kImageFormatGrayscale: | case kImageFormatGrayscale: | ||||
| #if defined(DGL_USE_GLES3) | |||||
| #if defined(DGL_USE_GLES) | |||||
| intformat = GL_R8; | intformat = GL_R8; | ||||
| #elif defined(DGL_USE_OPENGL3) | #elif defined(DGL_USE_OPENGL3) | ||||
| intformat = GL_RED; | intformat = GL_RED; | ||||
| @@ -422,18 +431,8 @@ static void setupOpenGLImage(const OpenGLImage& image, GLuint textureId) | |||||
| glBindTexture(GL_TEXTURE_2D, 0); | glBindTexture(GL_TEXTURE_2D, 0); | ||||
| } | } | ||||
| // static void drawOpenGLImage(const GraphicsContext& context, | |||||
| // const OpenGLImage& image, | |||||
| // const Point<int>& pos, | |||||
| // const GLuint textureId, | |||||
| // bool& setupCalled) | |||||
| // { | |||||
| // } | |||||
| void OpenGLImage::drawAt(const GraphicsContext& context, const Point<int>& pos) | void OpenGLImage::drawAt(const GraphicsContext& context, const Point<int>& pos) | ||||
| { | { | ||||
| // drawOpenGLImage(context, *this, pos, textureId, setupCalled); | |||||
| if (textureId == 0 || isInvalid()) | if (textureId == 0 || isInvalid()) | ||||
| return; | return; | ||||
| @@ -852,9 +852,9 @@ static int glnvg__renderCreateTexture(void* uptr, int type, int w, int h, int im | |||||
| glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); | ||||
| break; | break; | ||||
| default: | default: | ||||
| #if defined(NANOVG_GLES2) || defined (NANOVG_GL2) | |||||
| #if defined (NANOVG_GL2) | |||||
| glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, w, h, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, data); | glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, w, h, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, data); | ||||
| #elif defined(NANOVG_GLES3) | |||||
| #elif defined(NANOVG_GLES2) || defined(NANOVG_GLES3) | |||||
| glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, data); | glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, data); | ||||
| #else | #else | ||||
| glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, data); | glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, data); | ||||
| @@ -972,7 +972,7 @@ static int glnvg__renderUpdateTexture(void* uptr, int image, int x, int y, int w | |||||
| glTexSubImage2D(GL_TEXTURE_2D, 0, x,y, w,h, GL_RGBA, GL_UNSIGNED_BYTE, data); | glTexSubImage2D(GL_TEXTURE_2D, 0, x,y, w,h, GL_RGBA, GL_UNSIGNED_BYTE, data); | ||||
| break; | break; | ||||
| default: | default: | ||||
| #if defined(NANOVG_GLES2) || defined(NANOVG_GL2) | |||||
| #if defined(NANOVG_GL2) | |||||
| glTexSubImage2D(GL_TEXTURE_2D, 0, x,y, w,h, GL_LUMINANCE, GL_UNSIGNED_BYTE, data); | glTexSubImage2D(GL_TEXTURE_2D, 0, x,y, w,h, GL_LUMINANCE, GL_UNSIGNED_BYTE, data); | ||||
| #else | #else | ||||
| glTexSubImage2D(GL_TEXTURE_2D, 0, x,y, w,h, GL_RED, GL_UNSIGNED_BYTE, data); | glTexSubImage2D(GL_TEXTURE_2D, 0, x,y, w,h, GL_RED, GL_UNSIGNED_BYTE, data); | ||||