Suggest single-component texture format.

This commit is contained in:
John Preston 2021-06-30 11:47:15 +03:00
parent e73e1a6c0f
commit 9255d71038
2 changed files with 12 additions and 0 deletions

View file

@ -155,4 +155,14 @@ TexturedRect Image::texturedRect(
}; };
} }
GLint CurrentSingleComponentFormat() {
const auto context = QOpenGLContext::currentContext();
Assert(context != nullptr);
const auto format = context->format();
return (format.renderableType() == QSurfaceFormat::OpenGLES)
? GL_LUMINANCE
: GL_RED;
}
} // namespace Ui::GL } // namespace Ui::GL

View file

@ -134,4 +134,6 @@ private:
}; };
[[nodiscard]] GLint CurrentSingleComponentFormat();
} // namespace Ui::GL } // namespace Ui::GL