Compare commits
2 Commits
0e4c8865f1
...
b8b511dd27
Author | SHA1 | Date | |
---|---|---|---|
b8b511dd27 | |||
eedaa3e370 |
@ -55,10 +55,11 @@ def draw(size, mode, **data):
|
|||||||
assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt
|
assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt
|
||||||
|
|
||||||
buffer = BufferObject(size * attribute.stride)
|
buffer = BufferObject(size * attribute.stride)
|
||||||
attribute.set_region(buffer, 0, size, array)
|
data = (attribute.c_type * len(array))(*array)
|
||||||
|
buffer.set_data(data)
|
||||||
|
|
||||||
attribute.enable()
|
attribute.enable()
|
||||||
attribute.set_pointer(buffer.ptr)
|
attribute.set_pointer(buffer.ptr)
|
||||||
|
|
||||||
buffers.append(buffer) # Don't garbage collect it.
|
buffers.append(buffer) # Don't garbage collect it.
|
||||||
|
|
||||||
glDrawArrays(mode, 0, size)
|
glDrawArrays(mode, 0, size)
|
||||||
@ -108,10 +109,12 @@ def draw_indexed(size, mode, indices, **data):
|
|||||||
assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt
|
assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt
|
||||||
|
|
||||||
buffer = BufferObject(size * attribute.stride)
|
buffer = BufferObject(size * attribute.stride)
|
||||||
attribute.set_region(buffer, 0, size, array)
|
data = (attribute.c_type * len(array))(*array)
|
||||||
|
buffer.set_data(data)
|
||||||
|
|
||||||
attribute.enable()
|
attribute.enable()
|
||||||
attribute.set_pointer(buffer.ptr)
|
attribute.set_pointer(buffer.ptr)
|
||||||
buffers.append(buffer)
|
buffers.append(buffer) # Don't garbage collect it.
|
||||||
|
|
||||||
if size <= 0xff:
|
if size <= 0xff:
|
||||||
index_type = GL_UNSIGNED_BYTE
|
index_type = GL_UNSIGNED_BYTE
|
||||||
|
@ -55,6 +55,10 @@ if __name__ == '__main__':
|
|||||||
compiler.output_path = Path(out_path)
|
compiler.output_path = Path(out_path)
|
||||||
sys.argv.remove('--output')
|
sys.argv.remove('--output')
|
||||||
sys.argv.remove(out_path)
|
sys.argv.remove(out_path)
|
||||||
|
|
||||||
|
if '--lto=yes' in sys.argv:
|
||||||
|
compiler.use_lto = True
|
||||||
|
sys.argv.remove('--lto=yes')
|
||||||
|
|
||||||
# 检测 --no-pyglet-opt 参数
|
# 检测 --no-pyglet-opt 参数
|
||||||
pyglet_optimizations = True
|
pyglet_optimizations = True
|
||||||
|
Loading…
Reference in New Issue
Block a user