diff pytouhou/ui/opengl/shader.pyx @ 579:b8df946d394d

Add grouping for OpenGL calls, making traces much more readable.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 17 Aug 2014 16:16:58 +0200
parents 0f2af7552462
children 6e79756b7f42
line wrap: on
line diff
--- a/pytouhou/ui/opengl/shader.pyx
+++ b/pytouhou/ui/opengl/shader.pyx
@@ -15,7 +15,8 @@ from pytouhou.lib.opengl cimport \
           GL_COMPILE_STATUS, GL_INFO_LOG_LENGTH, glGetShaderInfoLog,
           glAttachShader, glLinkProgram, glGetProgramiv, glGetProgramInfoLog,
           GL_LINK_STATUS, glUseProgram, glGetUniformLocation, glUniform1fv,
-          glUniform4fv, glUniformMatrix4fv, glBindAttribLocation)
+          glUniform4fv, glUniformMatrix4fv, glBindAttribLocation,
+          glPushDebugGroup, GL_DEBUG_SOURCE_APPLICATION, glPopDebugGroup)
 
 from libc.stdlib cimport malloc, free
 from .backend cimport shader_header
@@ -29,6 +30,8 @@ cdef class Shader:
     # vert and frag take arrays of source strings the arrays will be
     # concattenated into one string by OpenGL
     def __init__(self, vert=None, frag=None):
+        glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Program creation")
+
         # create the program handle
         self.handle = glCreateProgram()
         # we are not linked yet
@@ -50,6 +53,8 @@ cdef class Shader:
         # attempt to link the program
         self.link()
 
+        glPopDebugGroup()
+
     cdef void create_shader(self, const GLchar *string, GLenum shader_type):
         cdef GLint temp
         cdef const GLchar *strings[2]