コード例 #1
0
ファイル: shader.py プロジェクト: mabl/glumpy
    def _update(self):
        """ Compile the source and checks everything's ok """

        log.debug("GPU: Compiling shader")

        if len(self.hooks):
            raise RuntimeError("Shader has pending hooks, cannot compile")

        # Set shader source
        gl.glShaderSource(self._handle, self.code)

        # Actual compilation
        gl.glCompileShader(self._handle)
        status = gl.glGetShaderiv(self._handle, gl.GL_COMPILE_STATUS)
        if not status:
            error = gl.glGetShaderInfoLog(self._handle)
            lineno, mesg = self._parse_error(error)
            self._print_error(mesg, lineno-1)
            raise RuntimeError("Shader compilation error")
コード例 #2
0
    def _update(self):
        """ Compile the source and checks everything's ok """

        log.debug("GPU: Compiling shader")

        if len(self.hooks):
            hooks = [name for name, snippet in self.hooks]
            error = "Shader has pending hooks (%s), cannot compile" % hooks
            raise RuntimeError(error)

        # Set shader version
        code = "#version 120\n" + self.code
        gl.glShaderSource(self._handle, code)

        # Actual compilation
        gl.glCompileShader(self._handle)
        status = gl.glGetShaderiv(self._handle, gl.GL_COMPILE_STATUS)
        if not status:
            error = gl.glGetShaderInfoLog(self._handle).decode()
            lineno, mesg = self._parse_error(error)
            self._print_error(mesg, lineno - 1)
            raise RuntimeError("Shader compilation error")
コード例 #3
0
ファイル: shader.py プロジェクト: WhiteSymmetry/glumpy
    def _update(self):
        """ Compile the source and checks everything's ok """

        log.debug("GPU: Compiling shader")

        if len(self.hooks):
            hooks = [name for name,snippet in self.hooks]
            error = "Shader has pending hooks (%s), cannot compile" % hooks
            raise RuntimeError(error)

        # Set shader version
        code = "#version 120\n" + self.code
        gl.glShaderSource(self._handle, code)

        # Actual compilation
        gl.glCompileShader(self._handle)
        status = gl.glGetShaderiv(self._handle, gl.GL_COMPILE_STATUS)
        if not status:
            error = gl.glGetShaderInfoLog(self._handle).decode()
            lineno, mesg = self._parse_error(error)
            self._print_error(mesg, lineno-1)
            raise RuntimeError("Shader compilation error")