Clean batch

48 переглядів
Перейти до першого непрочитаного повідомлення

Marco TheCamel

не прочитано,
12 жовт. 2019 р., 14:12:5012.10.19
Кому: pyglet-users
Hi,
for remove all from a batch, must I "call VertexList.delete to remove a vertex list from the batch" as in documentation?
Is it correct simply re-create the batch?

Example:
from pyglet.gl import *

window
= pyglet.window.Window(resizable=True)

the_batch
= pyglet.graphics.Batch()# batch creation

the_batch.add_indexed(3, pyglet.gl.GL_TRIANGLES, None,
                             
(0, 1, 2),
                             
('v2f', (10, 10, 10, 100, 100, 10)),
                             
('c3B', (255, 0, 0) * 3))

# ##########################
# Now I want delete all vertex list inside batch
# ##########################

the_
batch
= pyglet.graphics.Batch() # batch re-creation (empty old, create new)

the_batch.add_indexed(3, pyglet.gl.GL_TRIANGLES, None,
                             
(0, 1, 2),
                             
('v2f', (10, 10, 70, 200, 200, 70)),
                             
('c3B', (0, 255, 0) * 3))

@window.event
def on_draw():
    window
.clear()
   
the_batch.draw()

pyglet
.app.run()

Is it correct or this action leave in graphic card something?
Thanks,
Marco
Відповісти всім
Відповісти автору
Переслати
0 нових повідомлень