rendered paste body#include <GL/gl.h>
#include <GL/glut.h>
#include <sstream>
#include <iostream>
int main(int argc, char **argv)
{
// only to have a valid gl context
glutInit(&argc, argv);
glutCreateWindow("check version");
std::string gl_vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
if (gl_vendor == "NVIDIA Corporation")
{
std::istringstream version_stream(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
std::string ogl_version, ogl_vendor;
int driver_version_major, driver_version_minor;
char dummy;
version_stream >> ogl_version >> ogl_vendor >> driver_version_major >> dummy >> driver_version_minor;
std::cout << ogl_version << " *** " << ogl_vendor << " *** " << driver_version_major << driver_version_minor << std::endl;
if (driver_version_major >= 90)
{
std::cout << "found nvidia driver version >= 9xxx : " << driver_version_major << driver_version_minor << std::endl;
}
else
{
std::cout << "found nvidia driver version < 9xxx : " << driver_version_major << driver_version_minor << std::endl;
}
}
else
{
std::cout << "no nvidia driver found : " << gl_vendor << std::endl;
}
return 0;
}