mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-28 06:20:21 +02:00
OpenGL3: new version format
This commit is contained in:
@ -11,8 +11,24 @@ namespace video {
|
||||
return EDT_OPENGL3;
|
||||
}
|
||||
|
||||
OpenGLVersion COpenGL3Driver::getVersionFromOpenGL() const {
|
||||
GLint major, minor, profile;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
||||
glGetIntegerv(GL_MINOR_VERSION, &minor);
|
||||
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
|
||||
// The spec is clear a context can’t be both core and compatibility at the same time.
|
||||
// However, the returned value is a mask. Ask Khronos why. -- numzero
|
||||
if (profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
|
||||
return {OpenGLSpec::Compat, (u8)major, (u8)minor, 0};
|
||||
if (profile & GL_CONTEXT_CORE_PROFILE_BIT)
|
||||
return {OpenGLSpec::Core, (u8)major, (u8)minor, 0};
|
||||
os::Printer::log("Got unrecognized OpenGL profile", ELL_ERROR);
|
||||
return {OpenGLSpec::Core, (u8)major, (u8)minor, 0};
|
||||
}
|
||||
|
||||
IVideoDriver* createOpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)
|
||||
{
|
||||
os::Printer::log("Using COpenGL3Driver", ELL_INFORMATION);
|
||||
COpenGL3Driver* driver = new COpenGL3Driver(params, io, contextManager);
|
||||
driver->genericDriverInit(params.WindowSize, params.Stencilbuffer); // don't call in constructor, it uses virtual function calls of driver
|
||||
return driver;
|
||||
|
@ -8,11 +8,17 @@
|
||||
namespace irr {
|
||||
namespace video {
|
||||
|
||||
/// OpenGL 3+ driver
|
||||
///
|
||||
/// For OpenGL 3.2 and higher. Compatibility profile is required currently.
|
||||
class COpenGL3Driver : public COpenGL3DriverBase {
|
||||
friend IVideoDriver* createOpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
||||
public:
|
||||
using COpenGL3DriverBase::COpenGL3DriverBase;
|
||||
E_DRIVER_TYPE getDriverType() const override;
|
||||
|
||||
protected:
|
||||
OpenGLVersion getVersionFromOpenGL() const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user