If you have a high number of quads to render, then vertex list is
probably the way to go. However, be careful with the storage mode of
your data (i.e. cpu or gpu memory). From pyglet programming guide:

By default, pyglet assumes vertex data will be updated less often than
it is drawn, but more often than just during initialisation. You can
override this assumption for each attribute by affixing a usage
specification onto the end of the format string, detailed in the
following table:

Usage   Description
"/static"       Data is never or rarely modified after initialisation
"/dynamic"      Data is occasionally modified (default)
"/stream"       Data is updated every frame
In the following example a vertex list is created in which the
positional data is expected to change every frame, but the color data
is expected to remain relatively constant:

vertex_list = pyglet.graphics.vertex_list(1024, 'v3f/stream', 'c4B/
static')

The usage specification affects how pyglet lays out vertex data in
memory, whether or not it's stored on the video card, and is used as a
hint to OpenGL. Specifying a usage does not affect what operations are
possible with a vertex list (a static attribute can still be
modified), and may only have performance benefits on some hardware.


Nicolas


On Sep 30, 6:38 pm, Nikos <[email protected]> wrote:
> Hi all,
>
> First off, Pyglet is brilliant - thanks to all contributors!
>
> Now, I was wondering about the relative costs of the different ways of
> updating a vertex list. As an example, I am making a game where
> objects (read spaceships) move through 3D space and leave a fading
> trail behind them, as a HUD element.
>
> I have implemented this with a batched, indexed, vertex list which
> acts as a fifo -- new point comes in, old last point is replaced,
> indexes shift one place to the left. This means reading all indexes
> and storing them back, and updating one vertex in the list.
>
> Another way would be to keep a local, python list in the application,
> do the shifting in python and then just store everything back in the
> vertex list (which would not need to be indexed).
>
> These operations have to be done for each frame (so I am using '/
> stream' as a hint). Does anyone have recommendations as to which
> method might be reasonably expected to work faster?
>
> Thanks
> Nikos
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to