Hi Josh, If you look at the AbstractAttribute class in pyglet/graphics/vertexattribute.py, it might shed some light on things.
The vertex_list attributes are just ctype arrays, which are part of a large buffer. If you look at `domain.attributes`, you can find the buffers there. You should be able to move the data directly into those buffers. On Monday, August 27, 2018 at 8:29:29 AM UTC+9, Josh wrote: > > Is there a more efficient way to update large vertex list buffers than > vertex_list.attribute = some_iterable? For example, I'm guessing that by > default vertex_list.set_attribute is converting the iterable to a ctypes > array at some point. If I have the data in a numpy array and access it > directly as a ctypes array, could I skip this step? > > On Sat, Aug 25, 2018 at 9:54 AM Joshua Dempster <pana...@gmail.com > <javascript:>> wrote: > >> Thanks Ben! No reason not to use batches, just trying to understand the >> low-level module. >> >> On Thu, Aug 23, 2018 at 10:37 PM Benjamin Moran <benmo...@gmail.com >> <javascript:>> wrote: >> >>> Hi Josh, >>> >>> There is a typo with the vertex color type. It looks like you want to >>> use 8bit values, so If you change *c4b* to *c4B* it should work. >>> >>> By the way, is there a specific reason you're using Domains directly, >>> instead of just creating a Batch? There is nothing wrong with your >>> approach, but using a Batch might save a bit of boilerplate. >>> >>> -Ben >>> >>> On Thursday, August 23, 2018 at 3:13:34 AM UTC+9, Josh wrote: >>>> >>>> Hi all, >>>> >>>> I have what (I thought) is a MWE for drawing primitives with a >>>> VertexDomain: >>>> import pyglet >>>> from pyglet.gl import * >>>> >>>> if __name__ == '__main__': >>>> >>>> display = pyglet.window.Window(400, 400) >>>> >>>> >>>> domain = pyglet.graphics.vertexdomain.create_domain('v2i/stream', >>>> 'c4b/stream') >>>> vertex_list = domain.create(4) >>>> vertex_list.vertices = [50, 50, 50, 100, 100, 100, 100, 50] >>>> vertex_list.colors = [ >>>> 255, 255, 255, 255, >>>> 255, 0, 0, 255, >>>> 0, 255, 0, 255, >>>> 0, 0, 255, 255 >>>> ] >>>> >>>> @display.event >>>> def on_draw(): >>>> display.clear() >>>> pyglet.graphics.draw(1, GL_POINTS, ('v2i',(10,20))) >>>> domain.draw(GL_POINTS) >>>> >>>> pyglet.app.run() >>>> >>>> However, while the single pixel drawn directly by >>>> pyglet.graphics.drawshows up, the points from the vertex domain don't. >>>> What >>>> am I missing? >>>> >>>> >>>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "pyglet-users" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/pyglet-users/WRLoiTtztqM/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> pyglet-users...@googlegroups.com <javascript:>. >>> To post to this group, send email to pyglet...@googlegroups.com >>> <javascript:>. >>> Visit this group at https://groups.google.com/group/pyglet-users. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.