Trees | Indices | Help |
---|
|
1 """Element array buffer class. 2 3 @author: Stephan Wenger 4 @date: 2012-02-29 5 """ 6 7 import numpy as _np 8 9 import glitter.raw as _gl 10 from glitter.utils import buffer_dimensions_to_primitive, Datatype, coerce_array 11 from glitter.arrays.basebuffer import BaseBuffer 1214 _binding = "element_array_buffer_binding" 15 _target = _gl.GL_ELEMENT_ARRAY_BUFFER 1639 40 __all__ = ["ElementArrayBuffer"] 4118 if data is not None: 19 data = coerce_array(data, dtype, force_integer=True, force_unsigned=True) 20 dtype = Datatype.from_numpy(data.dtype) 21 if dtype.is_signed() or not dtype.is_integer(): 22 raise TypeError("%s must be of unsigned integer type" % self.__class__.__name__) 23 super(ElementArrayBuffer, self).set_data(data, shape, dtype, usage)2426 if mode is None: 27 if len(self.shape) >= 2: 28 mode = buffer_dimensions_to_primitive.get(self.shape[-1], None) 29 if mode is None: 30 raise ValueError("must specify mode") 31 if count is None: 32 count = _np.prod(self.shape) 33 if instances is None: 34 with self: 35 _gl.glDrawElements(mode._value, count, self.dtype._as_gl(), first * self.dtype.nbytes) 36 else: 37 with self: 38 _gl.glDrawElementsInstanced(mode._value, count, self.dtype._as_gl(), first * self.dtype.nbytes, instances)
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Mar 16 17:56:05 2012 | http://epydoc.sourceforge.net |