@@ -131,8 +131,8 @@ struct LVGLWidget<BaseWidget>::PrivateData {
131131
132132 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
133133 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
134- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER );
135- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER );
134+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
135+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
136136
137137 static constexpr const float transparent[] = { 0 .f , 0 .f , 0 .f , 0 .f };
138138 glTexParameterfv (GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, transparent);
@@ -363,13 +363,20 @@ void LVGLWidget<BaseWidget>::onDisplay()
363363 {
364364 #if LV_COLOR_DEPTH == 32
365365 static constexpr const GLenum format = GL_BGRA;
366+ static constexpr const GLenum ftype = GL_UNSIGNED_BYTE;
366367 #elif LV_COLOR_DEPTH == 24
367368 static constexpr const GLenum format = GL_BGR;
369+ static constexpr const GLenum ftype = GL_UNSIGNED_BYTE;
370+ #elif LV_COLOR_DEPTH == 16
371+ static constexpr const GLenum format = GL_RGB;
372+ static constexpr const GLenum ftype = GL_UNSIGNED_SHORT_5_6_5;
373+ #elif LV_COLOR_DEPTH == 8
374+ static constexpr const GLenum format = GL_LUMINANCE;
375+ static constexpr const GLenum ftype = GL_UNSIGNED_BYTE;
368376 #else
369377 #error Unsupported color format
370378 #endif
371379
372- glPixelStorei (GL_PACK_ALIGNMENT, 1 );
373380 glPixelStorei (GL_UNPACK_ALIGNMENT, 1 );
374381 glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
375382
@@ -379,7 +386,7 @@ void LVGLWidget<BaseWidget>::onDisplay()
379386 lvglData->updatedArea .x2 == width &&
380387 lvglData->updatedArea .y2 == height)
381388 {
382- glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA, width, height, 0 , format, GL_UNSIGNED_BYTE , lvglData->textureData );
389+ glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA, width, height, 0 , format, ftype , lvglData->textureData );
383390 }
384391 // partial size
385392 else
@@ -397,7 +404,7 @@ void LVGLWidget<BaseWidget>::onDisplay()
397404 partial_y,
398405 partial_width,
399406 partial_height,
400- format, GL_UNSIGNED_BYTE ,
407+ format, ftype ,
401408 lvglData->textureData + offset);
402409 }
403410
0 commit comments