File: nones.py

package info (click to toggle)
pyopengl 3.0.0~b6-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 5,696 kB
  • ctags: 26,182
  • sloc: python: 34,233; ansic: 70; sh: 26; makefile: 15
file content (41 lines) | stat: -rw-r--r-- 1,731 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Passing of None as an array data-type
"""
REGISTRY_NAME = 'nones'
from OpenGL.arrays import formathandler

class NoneHandler( formathandler.FormatHandler ):
	"""Numpy-specific data-type handler for OpenGL"""
	HANDLED_TYPES = (type(None), )
	def from_param( self, value ):
		"""Convert to a ctypes pointer value"""
		return None
	def dataPointer( self, value ):
		"""return long for pointer value"""
		return None
	def voidDataPointer( cls, value ):
		"""Given value in a known data-pointer type, return void_p for pointer"""
		return None
	def asArray( self, value, typeCode=None ):
		"""Given a value, convert to array representation"""
		return None
	def arrayToGLType( self, value ):
		"""Given a value, guess OpenGL type of the corresponding pointer"""
		raise TypeError( """Can't guess type of a NULL pointer""" )
	def arraySize( self, value, typeCode = None ):
		"""Given a data-value, calculate dimensions for the array"""
		return 0
	def arrayByteCount( self, value, typeCode = None ):
		"""Given a data-value, calculate number of bytes required to represent"""
		return 0
	def zeros( self, shape, typeCode= None ):
		"""Create an array of given shape with given typeCode"""
		raise TypeError( """Can't create NULL pointer filled with values""" )
	def ones( self, shape, typeCode= None ):
		"""Create an array of given shape with given typeCode"""
		raise TypeError( """Can't create NULL pointer filled with values""" )
	def unitSize( self, value, typeCode=None ):
		"""Determine unit size of an array (if possible)"""
		raise TypeError( """Can't determine unit size of a null pointer""" )
	def dimensions( self, value, typeCode=None ):
		"""Determine dimensions of the passed array value (if possible)"""
		return (0,)