Exemple #1
0
 def dataPointer(cls, instance):
     """Convert given instance to a data-pointer value (integer)"""
     try:
         return long(instance.__array_data__[0], 0)
     except AttributeError as err:
         instance = cls.asArray(instance)
         try:
             return long(instance.__array_interface__['data'][0])
         except AttributeError as err:
             return long(instance.__array_data__[0], 0)
Exemple #2
0
 def dataPointer(cls, instance):
     """Convert given instance to a data-pointer value (integer)"""
     try:
         return long(instance.__array_data__[0], 0)
     except AttributeError as err:
         instance = cls.asArray(instance)
         try:
             return long(instance.__array_interface__["data"][0])
         except AttributeError as err:
             return long(instance.__array_data__[0], 0)
Exemple #3
0
 def create_buffers( self ):
     """Create the internal buffer(s)"""
     assert not self.buffers, """Already created the buffer"""
     self.buffers = [ long(self.implementation.glGenBuffers(1)) ]
     self.target = self.resolve( self.target )
     self.usage = self.resolve( self.usage )
     self.implementation._DELETERS_[ id(self) ] = weakref.ref( self, self.implementation.deleter( self.buffers, id(self) ))
     return self.buffers
Exemple #4
0
 def create_buffers( self ):
     """Create the internal buffer(s)"""
     assert not self.buffers, """Already created the buffer"""
     self.buffers = [ long(self.implementation.glGenBuffers(1)) ]
     self.target = self.resolve( self.target )
     self.usage = self.resolve( self.usage )
     self.implementation._DELETERS_[ id(self) ] = weakref.ref( self, self.implementation.deleter( self.buffers, id(self) ))
     return self.buffers
Exemple #5
0
 def coerce( self, value ):
     """Coerce the given value to our type
     Allowable types:
         any object with true/false protocol
     """
     try:
         return long( value )
     except ValueError:
         raise ValueError( """Attempted to set value for an %s field which is not compatible: %s"""%( self.typeName(), repr(value) ))
Exemple #6
0
 def vrmlstr( self, value, lineariser=None):
     """Convert the given value to a VRML97 representation"""
     base = str( long(value) )
     if base[-1] in ('l','L'):
         base = base[:-1]
     return base