Skip to content

Commit a86a9ef

Browse files
committed
Fix build
1 parent 9af911e commit a86a9ef

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

dgl/OpenGL.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ImageFormat asDISTRHOImageFormat(const GLenum format)
3131
{
3232
switch (format)
3333
{
34-
#if defined(DGL_USE_OPENGL3) && !defined(DGL_USE_GLES2)
34+
#if defined(DGL_USE_OPENGL3)
3535
case GL_RED:
3636
#else
3737
case GL_LUMINANCE:
@@ -58,7 +58,7 @@ GLenum asOpenGLImageFormat(const ImageFormat format)
5858
case kImageFormatNull:
5959
break;
6060
case kImageFormatGrayscale:
61-
#if defined(DGL_USE_OPENGL3) && !defined(DGL_USE_GLES2)
61+
#if defined(DGL_USE_OPENGL3)
6262
return GL_RED;
6363
#else
6464
return GL_LUMINANCE;

dgl/src/NanoVG.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ DGL_EXT(PFNGLUNIFORMBLOCKBINDINGPROC, glUniformBlockBinding)
8989
//#define STB_IMAGE_STATIC
9090
#if defined(DGL_USE_GLES2)
9191
# define NANOVG_GLES2_IMPLEMENTATION
92+
#elif defined(DGL_USE_GLES3)
93+
# define NANOVG_GLES3_IMPLEMENTATION
9294
#elif defined(DGL_USE_OPENGL3)
9395
# define NANOVG_GL3_IMPLEMENTATION
9496
#else

dgl/src/OpenGL3.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ START_NAMESPACE_DGL
4848
#if defined(DGL_USE_GLES2) && defined(DGL_USE_GLES3)
4949
# error Build config error, both GLESv2 and GLESv3 requested at the same time
5050
#endif
51+
#if defined(DGL_USE_GLES2) && !defined(DGL_USE_GLES)
52+
# error Build config error, DGL_USE_GLES2 is defined but DGL_USE_GLES is not
53+
#endif
54+
#if defined(DGL_USE_GLES3) && !defined(DGL_USE_GLES)
55+
# error Build config error, DGL_USE_GLES3 is defined but DGL_USE_GLES is not
56+
#endif
57+
#if defined(DGL_USE_GLES) && !(defined(DGL_USE_GLES2) || defined(DGL_USE_GLES3))
58+
# error Build config error, DGL_USE_GLES is defined which requires either DGL_USE_GLES2 or DGL_USE_GLES3
59+
#endif
5160

5261
// --------------------------------------------------------------------------------------------------------------------
5362

@@ -384,7 +393,7 @@ static void setupOpenGLImage(const OpenGLImage& image, GLuint textureId)
384393
intformat = GL_RGB;
385394
break;
386395
case kImageFormatGrayscale:
387-
#if defined(DGL_USE_GLES3)
396+
#if defined(DGL_USE_GLES)
388397
intformat = GL_R8;
389398
#elif defined(DGL_USE_OPENGL3)
390399
intformat = GL_RED;
@@ -422,18 +431,8 @@ static void setupOpenGLImage(const OpenGLImage& image, GLuint textureId)
422431
glBindTexture(GL_TEXTURE_2D, 0);
423432
}
424433

425-
// static void drawOpenGLImage(const GraphicsContext& context,
426-
// const OpenGLImage& image,
427-
// const Point<int>& pos,
428-
// const GLuint textureId,
429-
// bool& setupCalled)
430-
// {
431-
// }
432-
433434
void OpenGLImage::drawAt(const GraphicsContext& context, const Point<int>& pos)
434435
{
435-
// drawOpenGLImage(context, *this, pos, textureId, setupCalled);
436-
437436
if (textureId == 0 || isInvalid())
438437
return;
439438

dgl/src/nanovg/nanovg_gl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,9 +852,9 @@ static int glnvg__renderCreateTexture(void* uptr, int type, int w, int h, int im
852852
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
853853
break;
854854
default:
855-
#if defined(NANOVG_GLES2) || defined (NANOVG_GL2)
855+
#if defined (NANOVG_GL2)
856856
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, w, h, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);
857-
#elif defined(NANOVG_GLES3)
857+
#elif defined(NANOVG_GLES2) || defined(NANOVG_GLES3)
858858
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, data);
859859
#else
860860
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
972972
glTexSubImage2D(GL_TEXTURE_2D, 0, x,y, w,h, GL_RGBA, GL_UNSIGNED_BYTE, data);
973973
break;
974974
default:
975-
#if defined(NANOVG_GLES2) || defined(NANOVG_GL2)
975+
#if defined(NANOVG_GL2)
976976
glTexSubImage2D(GL_TEXTURE_2D, 0, x,y, w,h, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);
977977
#else
978978
glTexSubImage2D(GL_TEXTURE_2D, 0, x,y, w,h, GL_RED, GL_UNSIGNED_BYTE, data);

0 commit comments

Comments
 (0)