20 using namespace visualization;
22 std::string forwardCompatStr =
23 (forwardCompat ?
"GLFW_OPENGL_FORWARD_COMPAT " :
"");
24 std::string profileStr =
"UnknownProfile";
25 #define CLOUDVIEWER_CHECK_PROFILESTR(p) \
26 if (profileId == p) { \
32 #undef CLOUDVIEWER_CHECK_PROFILESTR
35 forwardCompatStr, profileStr);
41 #ifdef HEADLESS_RENDERING
42 glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_NULL);
48 glfwWindowHint(GLFW_SAMPLES, 4);
49 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, major);
50 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, minor);
51 if (forwardCompat) glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
52 if (setProfile) glfwWindowHint(GLFW_OPENGL_PROFILE, profileId);
53 glfwWindowHint(GLFW_VISIBLE, 0);
55 GLFWwindow *window_ = glfwCreateWindow(640, 480,
"GLInfo",
NULL,
NULL);
61 glfwMakeContextCurrent(window_);
64 auto reportGlStringFunc = [](GLenum id, std::string
name) {
68 PFNGLGETSTRINGIPROC _glGetString =
69 (PFNGLGETSTRINGIPROC)glfwGetProcAddress(
"glGetString");
70 const auto r = _glGetString(
id, 0);
72 const auto r = glGetString(
id);
79 reinterpret_cast<const char *
>(r));
82 #define CLOUDVIEWER_REPORT_GL_STRING(n) reportGlStringFunc(n, #n)
88 #undef CLOUDVIEWER_REPORT_GL_STRING
90 if (window_) glfwDestroyWindow(window_);
94 int main(
int argc,
char **argv) {
95 TryGLVersion(1, 0,
false,
false, GLFW_OPENGL_ANY_PROFILE);
96 TryGLVersion(3, 2,
true,
true, GLFW_OPENGL_CORE_PROFILE);
97 TryGLVersion(4, 1,
false,
false, GLFW_OPENGL_ANY_PROFILE);
98 TryGLVersion(3, 3,
false,
true, GLFW_OPENGL_CORE_PROFILE);
99 TryGLVersion(3, 3,
true,
true, GLFW_OPENGL_CORE_PROFILE);
100 TryGLVersion(3, 3,
false,
true, GLFW_OPENGL_COMPAT_PROFILE);
101 TryGLVersion(3, 3,
false,
true, GLFW_OPENGL_ANY_PROFILE);
102 TryGLVersion(1, 0,
false,
true, GLFW_OPENGL_ANY_PROFILE);
#define CLOUDVIEWER_REPORT_GL_STRING(n)
int main(int argc, char **argv)
void TryGLVersion(int major, int minor, bool forwardCompat, bool setProfile, int profileId)
#define CLOUDVIEWER_CHECK_PROFILESTR(p)
void GLFWErrorCallback(int error, const char *description)
static void error(char *msg)
void SetVerbosityLevel(VerbosityLevel level)
Generic file read and write utility for python interface.