-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
95 lines (69 loc) · 1.93 KB
/
main.cpp
File metadata and controls
95 lines (69 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <iostream>
#include <string>
#include <algorithm>
#include "GL/glew.h"
#include "GL/glut.h"
void display()
{
glutSwapBuffers();
}
int main(int argc, char* argv[])
{
// initialize the GLUT system
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutInitWindowSize(50, 50);
glutInitWindowPosition(0, 0);
// mainWindow will have the ID 1
glutCreateWindow("empty");
glutDisplayFunc(display);
glutIdleFunc(NULL);
glutMouseFunc(NULL);
glutMotionFunc(NULL);
glutPassiveMotionFunc(NULL);
glutReshapeFunc(NULL);
glutKeyboardFunc(NULL);
GLenum err = glewInit();
if (GLEW_OK != err)
{
std::cerr << "Error: " << glewGetErrorString(err) << std::endl;
exit(1);
}
const char* str = 0;
std::cout << " - GPU Driver Info" << std::endl;
std::cout << " ------------------" << std::endl;
str = (const char*)glGetString(GL_VENDOR);
if (str)
{
std::string vendor(str);
std::string firstWord = vendor.substr(0, vendor.find(" "));
std::cout << " Vendor: " << vendor << std::endl;
if (!firstWord.empty())
{
std::transform(firstWord.begin(), firstWord.end(), firstWord.begin(), ::tolower);
std::cout << " \t - Relevant: " << firstWord << std::endl;
}
}
str = (const char*)glGetString(GL_RENDERER);
if (str)
{
std::string renderer(str);
std::cout << " Renderer: " << renderer << std::endl;
}
str = (const char*)glGetString(GL_VERSION);
if (str)
{
std::string version(str);
std::string lastWord = version.substr(version.find_last_of(" ") + 1);
std::cout << " Version: " << version << std::endl;
std::cout << " \t - Relevant: " << lastWord << std::endl;
}
str = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
if (str)
{
std::string glslVersion(str);
std::cout << " GLSL Version: " << glslVersion << std::endl;
}
glutMainLoop();
return 0;
}