コード例 #1
0
ファイル: variable.py プロジェクト: Pandinosaurus/glumpy
    def __init__(self, program, name, gtype):
        """ Initialize the data into default state """

        # Make sure variable type is allowed (for ES 2.0 shader)
        if gtype not in [
                gl.GL_FLOAT, gl.GL_FLOAT_VEC2, gl.GL_FLOAT_VEC3,
                gl.GL_FLOAT_VEC4, gl.GL_INT, gl.GL_BOOL, gl.GL_FLOAT_MAT2,
                gl.GL_FLOAT_MAT3, gl.GL_FLOAT_MAT4, gl.GL_SAMPLER_1D,
                gl.GL_SAMPLER_2D, gl.GL_SAMPLER_CUBE
        ]:
            raise TypeError("Unknown variable type")

        GLObject.__init__(self)

        # Program this variable belongs to
        self._program = program

        # Name of this variable in the program
        self._name = name

        # Build dtype
        size, _, base = gl_typeinfo[gtype]
        self._dtype = (name, base, size)

        # GL type
        self._gtype = gtype

        # CPU data
        self._data = None

        # Whether this variable is active
        self._active = True
コード例 #2
0
ファイル: variable.py プロジェクト: glumpy/glumpy
    def __init__(self, program, name, gtype):
        """ Initialize the data into default state """

        # Make sure variable type is allowed (for ES 2.0 shader)
        if gtype not in [gl.GL_FLOAT,      gl.GL_FLOAT_VEC2,
                         gl.GL_FLOAT_VEC3, gl.GL_FLOAT_VEC4,
                         gl.GL_INT,        gl.GL_BOOL,
                         gl.GL_FLOAT_MAT2, gl.GL_FLOAT_MAT3,
                         gl.GL_FLOAT_MAT4, gl.GL_SAMPLER_1D,
                         gl.GL_SAMPLER_2D, gl.GL_SAMPLER_CUBE]:
            raise TypeError("Unknown variable type")

        GLObject.__init__(self)

        # Program this variable belongs to
        self._program = program

        # Name of this variable in the program
        self._name = name

        # Build dtype
        size, _, base = gl_typeinfo[gtype]
        self._dtype = (name,base,size)

        # GL type
        self._gtype = gtype

        # CPU data
        self._data = None

        # Whether this variable is active
        self._active = True
コード例 #3
0
 def __init__(self, width=0, height=0, format=None):
     GLObject.__init__(self)
     self._width = width
     self._height = height
     self._target = gl.GL_RENDERBUFFER
     self._format = format
     self._need_resize = True
コード例 #4
0
ファイル: framebuffer.py プロジェクト: WhiteSymmetry/glumpy
 def __init__(self, width=0, height=0, format=None):
     GLObject.__init__(self)
     self._width = width
     self._height = height
     self._target = gl.GL_RENDERBUFFER
     self._format = format
     self._need_resize = True
コード例 #5
0
ファイル: texture.py プロジェクト: brianholland/glumpy
 def __init__(self, target):
     GLObject.__init__(self)
     self._target = target
     # self._interpolation = gl.GL_LINEAR, gl.GL_LINEAR
     self._interpolation = gl.GL_NEAREST, gl.GL_NEAREST
     self._wrapping = gl.GL_CLAMP_TO_EDGE
     self._cpu_format = None
     self._gpu_format = None
コード例 #6
0
ファイル: texture.py プロジェクト: m0r13/glumpy
 def __init__(self, target):
     GLObject.__init__(self)
     self._target = target
     # self._interpolation = gl.GL_LINEAR, gl.GL_LINEAR
     self._interpolation = gl.GL_NEAREST, gl.GL_NEAREST
     self._wrapping = gl.GL_CLAMP_TO_EDGE
     self._cpu_format = None
     self._gpu_format = None
コード例 #7
0
    def test_init_default(self):
        O = GLObject()

        assert O._handle == -1
        assert O._target is None
        assert O._need_create is True
        assert O._need_update is True
        assert O._need_delete is False
        assert O._id > 0
        assert O._id == GLObject._idcount
コード例 #8
0
ファイル: framebuffer.py プロジェクト: WhiteSymmetry/glumpy
    def __init__(self, color=None, depth=None, stencil=None):
        """
        """

        GLObject.__init__(self)

        self._width = 0
        self._height = 0
        self._color = None
        self._depth = None
        self._stencil = None
        self._need_attach = True
        self._pending_attachments = []

        if color is not None:
            self.color = color
        if depth is not None:
            self.depth = depth
        if stencil is not None:
            self.stencil = stencil
コード例 #9
0
    def __init__(self, color=None, depth=None, stencil=None):
        """
        """

        GLObject.__init__(self)

        self._width = 0
        self._height = 0
        self._color = None
        self._depth = None
        self._stencil = None
        self._need_attach = True
        self._pending_attachments = []

        if color is not None:
            self.color = color
        if depth is not None:
            self.depth = depth
        if stencil is not None:
            self.stencil = stencil
コード例 #10
0
 def __init__(self, target, usage=gl.GL_DYNAMIC_DRAW):
     GLObject.__init__(self)
     self._target = target
     self._usage = usage
コード例 #11
0
 def __init__(self, target, usage):
     GLObject.__init__(self)
     self._target = target
     self._usage = usage
コード例 #12
0
ファイル: array.py プロジェクト: yuyu2172/glumpy
 def __init__(self, usage=gl.GL_DYNAMIC_DRAW):
     GLObject.__init__(self)
     self._target = gl.GL_ARRAY_BUFFER
     self._buffer = self.view(VertexBuffer)
     self._buffer.__init__(usage)
コード例 #13
0
ファイル: buffer.py プロジェクト: WhiteSymmetry/glumpy
 def __init__(self, target, usage=gl.GL_DYNAMIC_DRAW):
     GLObject.__init__(self)
     self._target = target
     self._usage = usage
コード例 #14
0
ファイル: buffer.py プロジェクト: glumpy/glumpy
 def __init__(self, target, usage):
     GLObject.__init__(self)
     self._target = target
     self._usage = usage