Repository navigation
Expand file tree
/
Copy pathutil.cpp
More file actions
74 lines (67 loc) · 2.14 KB
/
Copy pathutil.cpp
File metadata and controls
74 lines (67 loc) · 2.14 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
#include <GL/glew.h>
#include <iostream>
#include <cmath>
using namespace std;
#include "util.h"
void logGLParameters() {
GLenum params[] = {
GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
GL_MAX_CUBE_MAP_TEXTURE_SIZE,
GL_MAX_DRAW_BUFFERS,
GL_MAX_FRAGMENT_UNIFORM_COMPONENTS,
GL_MAX_TEXTURE_IMAGE_UNITS,
GL_MAX_TEXTURE_SIZE,
GL_MAX_VARYING_FLOATS,
GL_MAX_VERTEX_ATTRIBS,
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS,
GL_MAX_VERTEX_UNIFORM_COMPONENTS,
GL_MAX_VIEWPORT_DIMS
};
const char* names[] = {
"GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS",
"GL_MAX_CUBE_MAP_TEXTURE_SIZE",
"GL_MAX_DRAW_BUFFERS",
"GL_MAX_FRAGMENT_UNIFORM_COMPONENTS",
"GL_MAX_TEXTURE_IMAGE_UNITS",
"GL_MAX_TEXTURE_SIZE",
"GL_MAX_VARYING_FLOATS",
"GL_MAX_VERTEX_ATTRIBS",
"GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS",
"GL_MAX_VERTEX_UNIFORM_COMPONENTS",
"GL_MAX_VIEWPORT_DIMS"
};
cout << "GL Context Parameters:" << endl;
const GLubyte *renderer = glGetString(GL_RENDERER);
const GLubyte *version = glGetString(GL_VERSION);;
cout << "Renderer: " << renderer << endl;
cout << "OpenGL version supported: " << version << endl;
// integers - only works if the order is 0-10 integer return types
for (int i = 0; i < 10; i++) {
int v = 0;
glGetIntegerv(params[i], &v);
cout << names[i] << " " << v << endl;
}
// others
int v[2];
v[0] = v[1] = 0;
glGetIntegerv(params[10], v);
cout << names[10] << " " << v[0] << " " << v[1] << endl;
cout << "-----------------------------" << endl;
}
std::string getBaseDir(const std::string & filepath) {
if (filepath.find_last_of("/\\") != std::string::npos) {
return filepath.substr(0, filepath.find_last_of("/\\"));
}
return "";
}
bool fileExists(const std::string & abs_filename) {
bool ret;
FILE *fp = fopen(abs_filename.c_str(), "rb");
if (fp) {
ret = true;
fclose(fp);
} else {
ret = false;
}
return ret;
}