Skip to content

Commit 7986e99

Browse files
Add offset parameter to from_dtype.
This lets you provide a base offset for the dtype structure instead of it always assuming the data starts at 0.
1 parent 1fd9081 commit 7986e99

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pygly/vertex_buffer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,15 @@ def pop_attributes( self ):
264264
class BufferAttribute( object ):
265265

266266
@classmethod
267-
def from_dtype( cls, buffer, dtype, name, **kwargs ):
267+
def from_dtype( cls, buffer, dtype, name, offset = 0, **kwargs ):
268268
import numpy_utils
269269

270270
args = {
271271
'buffer': buffer,
272272
'values_per_vertex': numpy_utils.dtype_element_count( dtype, name ),
273273
'gl_type': numpy_utils.dtype_gl_enum( dtype, name ),
274274
'stride': dtype.itemsize,
275-
'offset': numpy_utils.dtype_offset( dtype, name )
275+
'offset': offset + numpy_utils.dtype_offset( dtype, name )
276276
}
277277
args.update( kwargs )
278278

0 commit comments

Comments
 (0)