Skip to content

Commit

Permalink
Client|GL: Composing OpenGL information as a styled text string
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 24, 2013
1 parent d2881d2 commit d81079e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
8 changes: 8 additions & 0 deletions doomsday/client/include/gl/sys_opengl.h
Expand Up @@ -213,6 +213,14 @@ boolean Sys_GLCheckError(void);

#ifdef __cplusplus
} // extern "C"

/**
* Information about the OpenGL driver and its capabilities.
*
* @return Styled text.
*/
de::String Sys_GLDescription();

#endif

#endif /* LIBDENG_SYSTEM_OPENGL_H */
30 changes: 15 additions & 15 deletions doomsday/client/src/gl/sys_opengl.cpp
Expand Up @@ -176,31 +176,25 @@ static void initialize(void)
#endif
}

static void printGLUInfo(void)
{
GLfloat fVals[2];
GLint iVal;
#define TABBED(A, B) _E(Ta) " " A " " _E(Tb) << B << "\n"

de::String Sys_GLDescription()
{
DENG_ASSERT_IN_MAIN_THREAD();
DENG_ASSERT_GL_CONTEXT_ACTIVE();

LOG_MSG(_E(b) "OpenGL information:");

de::String str;
QTextStream os(&str);

#define TABBED(A, B) _E(Ta) " " A " " _E(Tb) << B << "\n"
os << _E(b) "OpenGL information:\n" << _E(.);

os << TABBED("Version:", (char const *) glGetString(GL_VERSION));
os << TABBED("Renderer:", (char const *) glGetString(GL_RENDERER));
os << TABBED("Vendor:", (char const *) glGetString(GL_VENDOR));

LOG_MSG("%s") << str.rightStrip();

str.clear();
os.setString(&str);
os << _E(T`) "Capabilities:\n";

os << "Capabilities:\n";
GLint iVal;

#ifdef USE_TEXTURE_COMPRESSION_S3
if(GL_state.extensions.texCompressionS3)
Expand All @@ -226,19 +220,25 @@ static void printGLUInfo(void)
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &iVal);
os << TABBED("Maximum texture size:", iVal);

GLfloat fVals[2];
glGetFloatv(GL_LINE_WIDTH_GRANULARITY, fVals);
os << TABBED("Line width granularity:", fVals[0]);

glGetFloatv(GL_LINE_WIDTH_RANGE, fVals);
os << TABBED("Line width range:", fVals[0] << "..." << fVals[1]);

LOG_MSG("%s") << str.rightStrip();

Sys_GLPrintExtensions();
return str.rightStrip();

#undef TABBED
}

static void printGLUInfo(void)
{
LOG_MSG("%s") << Sys_GLDescription();

Sys_GLPrintExtensions();
}

#if 0
#ifdef WIN32
static void testMultisampling(HDC hDC)
Expand Down

0 comments on commit d81079e

Please sign in to comment.