OpenGL3: new version format

This commit is contained in:
numzero
2023-04-15 16:52:15 +03:00
committed by sfan5
parent c4ab49201b
commit 1d782702e1
7 changed files with 65 additions and 4 deletions

View File

@ -11,8 +11,19 @@ namespace video {
return EDT_OGLES2;
}
OpenGLVersion COpenGLES2Driver::getVersionFromOpenGL() const {
auto version_string = reinterpret_cast<const char *>(glGetString(GL_VERSION));
int major, minor;
if (sscanf(version_string, "OpenGL ES %d.%d", &major, &minor) != 2) {
os::Printer::log("Failed to parse OpenGL ES version string", version_string, ELL_ERROR);
return {OpenGLSpec::ES, 0, 0, 0};
}
return {OpenGLSpec::ES, (u8)major, (u8)minor, 0};
}
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)
{
os::Printer::log("Using COpenGLES2Driver", ELL_INFORMATION);
COpenGLES2Driver* driver = new COpenGLES2Driver(params, io, contextManager);
driver->genericDriverInit(params.WindowSize, params.Stencilbuffer); // don't call in constructor, it uses virtual function calls of driver
return driver;