Skip to content

Commit

Permalink
Log the OpenGL info
Browse files Browse the repository at this point in the history
  • Loading branch information
tlecomte committed Jan 16, 2018
1 parent d133397 commit f66d9b5
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions friture/plotting/glCanvasWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,52 @@ def drawGlData(self):
def sizeHint(self):
return QtCore.QSize(50, 50)

def logOpenGLFormat(self):
try:
format = self.format()

profile = format.profile()
if profile == QtGui.QSurfaceFormat.NoProfile:
profile_name = "No profile"
elif profile == QtGui.QSurfaceFormat.CoreProfile:
profile_name = "Core profile"
elif profile == QtGui.QSurfaceFormat.CompatibilityProfile:
profile_name = "Compatibility profile"
else:
profile_name = "Unknown profile"

renderableType = format.renderableType()
if renderableType == QtGui.QSurfaceFormat.DefaultRenderableType:
renderableType_name = "Unspecified rendering"
elif renderableType == QtGui.QSurfaceFormat.OpenGL:
renderableType_name = "Desktop OpenGL rendering"
elif renderableType == QtGui.QSurfaceFormat.OpenGLES:
renderableType_name = "OpenGL ES 2.0 rendering"
elif renderableType == QtGui.QSurfaceFormat.OpenVG:
renderableType_name = "OpenVG rendering"
else:
renderableType_name = "Unknown rendering"

self.logger.info(
"OpenGL format: version %d.%d, %s, %s",
format.majorVersion(),
format.minorVersion(),
profile_name,
renderableType_name)

self.logger.info(
"%s, %s, Version: %s, Shaders: %s, Extensions: %s",
GL.glGetString(GL.GL_VENDOR).decode("utf-8"),
GL.glGetString(GL.GL_RENDERER).decode("utf-8"),
GL.glGetString(GL.GL_VERSION).decode("utf-8"),
GL.glGetString(GL.GL_SHADING_LANGUAGE_VERSION).decode("utf-8"),
GL.glGetIntegerv(GL.GL_NUM_EXTENSIONS)
)
except Exception:
self.logger.exception("Failed to log the OpenGL info")

def initializeGL(self):
self.logOpenGLFormat()
self.clearErrors()

quad_vertex_shader = shaders.compileShader(
Expand Down

0 comments on commit f66d9b5

Please sign in to comment.