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
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
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
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
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
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
def __init__(self, target, usage=gl.GL_DYNAMIC_DRAW): GLObject.__init__(self) self._target = target self._usage = usage
def __init__(self, target, usage): GLObject.__init__(self) self._target = target self._usage = usage
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)