Just a quick GL info logger func for any of you

#1
   #if JUCE_OPENGL
    void logOpenGLInfoCallback (OpenGLContext&)
    {
        int major = 0, minor = 0;
        glGetIntegerv (GL_MAJOR_VERSION, &major);
        glGetIntegerv (GL_MINOR_VERSION, &minor);

        String stats;
        stats
        << "---------------------------" << newLine
        << "=== OpenGL/GPU Information ===" << newLine
        << "Vendor: " << String ((const char*) glGetString (GL_VENDOR)) << newLine
        << "Renderer: " << String ((const char*) glGetString (GL_RENDERER)) << newLine
        << "OpenGL Version: " << String ((const char*) glGetString (GL_VERSION)) << newLine
        << "OpenGL Major: " << String (major) << newLine
        << "OpenGL Minor: " << String (minor) << newLine
        << "OpenGL Shading Language Version: " << String ((const char*) glGetString (GL_SHADING_LANGUAGE_VERSION)) << newLine
        << "---------------------------" << newLine;

        Logger::writeToLog (stats);
    }
   #endif
#if JUCE_OPENGL
// Somewhere where a context is attached, and the context is valid:
static auto logGlInfoOnce = [] (OpenGLContext& c)
{
    static std::once_flag openGlLogFlag;
    std::call_once (openGlLogFlag, logOpenGLInfoCallback, c);
};

context->executeOnGLThread (logGlInfoOnce, false);
#endif
3 Likes