Skip to content

Commit d652bc3

Browse files
committed
LVGL: Fix OpenGL3 rendering when not using 32bit
Signed-off-by: falkTX <[email protected]>
1 parent 3246cc3 commit d652bc3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

generic/LVGL.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,12 @@ void LVGLWidget<BaseWidget>::onDisplay()
494494
#error Unsupported color format
495495
#endif
496496

497+
#if LV_COLOR_DEPTH == 32
498+
static constexpr const GLenum intformat = GL_RGBA;
499+
#else
500+
static constexpr const GLenum intformat = GL_RGB;
501+
#endif
502+
497503
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
498504
glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
499505

@@ -503,7 +509,7 @@ void LVGLWidget<BaseWidget>::onDisplay()
503509
lvglData->updatedArea.x2 == width &&
504510
lvglData->updatedArea.y2 == height)
505511
{
506-
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, format, ftype, lvglData->textureData);
512+
glTexImage2D(GL_TEXTURE_2D, 0, intformat, width, height, 0, format, ftype, lvglData->textureData);
507513
}
508514
// partial size
509515
else

0 commit comments

Comments
 (0)