Log OpenGL Vendor, Renderer and Version on startup

This commit is contained in:
AnyOldName3 2021-12-15 22:17:38 +00:00
parent 7d3c5f529a
commit d66907ba67
3 changed files with 48 additions and 1 deletions

View file

@ -43,6 +43,7 @@
#include <components/sceneutil/screencapture.hpp>
#include <components/sceneutil/depth.hpp>
#include <components/sceneutil/util.hpp>
#include "mwinput/inputmanagerimp.hpp"
@ -239,6 +240,20 @@ namespace
{
void operator()(std::string) const {}
};
class IdentifyOpenGLOperation : public osg::GraphicsOperation
{
public:
IdentifyOpenGLOperation() : GraphicsOperation("IdentifyOpenGLOperation", false)
{}
void operator()(osg::GraphicsContext* graphicsContext) override
{
Log(Debug::Info) << "OpenGL Vendor: " << glGetString(GL_VENDOR);
Log(Debug::Info) << "OpenGL Renderer: " << glGetString(GL_RENDERER);
Log(Debug::Info) << "OpenGL Version: " << glGetString(GL_VERSION);
}
};
}
void OMW::Engine::executeLocalScripts()
@ -643,8 +658,12 @@ void OMW::Engine::createWindow(Settings::Manager& settings)
camera->setGraphicsContext(graphicsWindow);
camera->setViewport(0, 0, graphicsWindow->getTraits()->width, graphicsWindow->getTraits()->height);
osg::ref_ptr<SceneUtil::OperationSequence> realizeOperations = new SceneUtil::OperationSequence(false);
mViewer->setRealizeOperation(realizeOperations);
realizeOperations->add(new IdentifyOpenGLOperation());
if (Debug::shouldDebugOpenGL())
mViewer->setRealizeOperation(new Debug::EnableGLDebugOperation());
realizeOperations->add(new Debug::EnableGLDebugOperation());
mViewer->realize();