(self, source, shader_type)
return shader
Compile a shader (vertex or fragment shader).
        
        Arguments:
          * source: the shader source code as a string.
          * shader_type: either gl.GL_VERTEX_SHADER or gl.GL_FRAGMENT_SHADER.
Compile a shader (vertex or fragment shader).
        
        Arguments:
          * source: the shader source code as a string.
          * shader_type: either gl.GL_VERTEX_SHADER or gl.GL_FRAGMENT_SHADER.
Compile a shader ( vertex or fragment shader ) . Arguments : * source : the shader source code as a string . * shader_type : either gl . GL_VERTEX_SHADER or gl . GL_FRAGMENT_SHADER .
def compile_shader(self, source, shader_type):
        """Compile a shader (vertex or fragment shader).
        
        Arguments:
          * source: the shader source code as a string.
          * shader_type: either gl.GL_VERTEX_SHADER or gl.GL_FRAGMENT_SHADER.
        
        """
        # compile shader
        shader = gl.glCreateShader(shader_type)
        gl.glShaderSource(shader, source)
        gl.glCompileShader(shader)
        
        result = gl.glGetShaderiv(shader, gl.GL_COMPILE_STATUS)
        infolog = gl.glGetShaderInfoLog(shader)
        if infolog:
            infolog = "\n" + infolog.strip()
        # check compilation error
        if not(result) and infolog:
            msg = "Compilation error for %s." % str(shader_type)
            if infolog is not None:
                msg += infolog
            msg += source
            raise RuntimeError(msg)
        else:
            log_debug("Compilation succeeded for %s.%s" % (str(shader_type), infolog))
        return shader
def compile_shader ( self , source , shader_type ) : # compile shader shader = gl . glCreateShader ( shader_type ) gl . glShaderSource ( shader , source ) gl . glCompileShader ( shader ) result = gl . glGetShaderiv ( shader , gl . GL_COMPILE_STATUS ) infolog = gl . glGetShaderInfoLog ( shader ) if infolog : infolog = "\n" + infolog . strip ( ) # check compilation error if not ( result ) and infolog : msg = "Compilation error for %s." % str ( shader_type ) if infolog is not None : msg += infolog msg += source raise RuntimeError ( msg ) else : log_debug ( "Compilation succeeded for %s.%s" % ( str ( shader_type ) , infolog ) ) return shader