>From the looks of the code, it seems that "IndexedVertexDomain" is the way to go.
Down the bottom of this file http://code.google.com/p/pyglet/source/browse/pyglet/graphics/vertexdomain.py You can call 'create' with the number of indices you desire for each batch. The 'draw' method takes a vertex_list. So if I'm correct, this method lets you have multiple index lists referencing a single vertex list. Cheers, Adam On Apr 18, 4:39 pm, AdamGriffiths <[email protected]> wrote: > Woah.. mega derp. > > My original question was about my OBJ format loader. Not my MD2 > loader. > Please ignore my last reply stating I "solved" my problem. > I still have the same issue open with my OBJ loader. > Unfortunately I'm working on more pressing matters. When I get back to > this problem I'll look into those functions a bit more. > > Cheers, > Adam > > On Apr 18, 4:36 pm, AdamGriffiths <[email protected]> wrote: > > > > > > > > > Thanks for the reply =) > > > I've "solved" my problem by bypassing it. MD2 stores vertex data in 2 > > formats. > > -The first in a straight vertex lists > > -The second an "optimised opengl command list". > > > The optimised OGL command list was "optimised" back then. > > MD2 is from Quake 2, so ~1998. Which is when I had a Monster 3D voodoo > > 1 with 4mb VRam =P. > > > This is old thinking and the state changes that are caused by > > constantly switching between GL_FAN and GL_TRIANGLES are far slower > > than just throwing vertices at the graphics card. > > So I "solved" my problem by just using the straight vertex lists. > > > That said, if anyone has any info on how to use shared vertex data > > with multiple sets of indicies, I'd love to hear it because I'm sure > > I'll run into this problem down the track again. > > > Cheers, > > Adam > > > On Apr 15, 5:26 am, Nathan <[email protected]> wrote: > > > > I would love to answer your question. Unfortunately I'm an OpenGL newbie > > > and don't know the answer(s). Thought I'd just let you know that at least > > > someone is reading. :-) > > > > Have you considered reading the Pyglet source code to see what it is doing > > > in VertexList, IndexedVertexList, and Batch to see if you could get your > > > answer that way? > > > > ~ Nathan > > > > On Saturday, March 31, 2012, AdamGriffiths wrote: > > > > bump? > > > > > On Mar 25, 4:18 pm, AdamGriffiths > > > > <[email protected]<javascript:;>> > > > > wrote: > > > > > Hi all, > > > > > > I'm working on a python framework that sits ontop of pyglet. > > > >https://github.com/adamlwgriffiths/PyGLy > > > > > > My modern opengl knowledge is limited and I'm trying to find the best > > > > > way to render meshes. The best example of what I'm working on > > > > > optimising is my implementation of Wavefront OBJ meshes. > > > > > > My current implementation uses a single display list and simply makes > > > > > opengl calls (glVertex3f, etc). > > > >https://github.com/adamlwgriffiths/PyGLy/blob/master/pygly/mesh/obj_m... > > > > > > This works and is flexible, but the number of calls from python -> c/ > > > > > opengl causes the load time to increase. > > > > > My MD2 loader parses the MD2 file almost instantly, but pushing into > > > > > OGL takes around 10 seconds using the same method as my OBJ > > > > > implementation. > > > > > > It looks like the obvious optimisation would be to batch up the > > > > > vertices into a VertexList / IndexedVertexList with the appropriate > > > > > format specified and do a few pyglet / opengl calls rather than the > > > > > hundreds that I'm doing currently. > > > > > > My problem comes with the usage of multiple groups of primitives > > > > > within the 1 set of vertices. Ie, multiple tri fans would share > > > > > vertices. > > > > > I'm not sure how to create multiple lists of indices without > > > > > duplicating the vertices. > > > > > As most of the tri fan groups have only about 3 - 5 vertices, this > > > > > would be a massive waste. > > > > > > Even better would be to use Pyglet's Batch, that way different index > > > > > groups can use different textures, which I will have to do to support > > > > > the OBJ format properly. > > > > > > So my questions are: > > > > > Can I specify multiple groups of indices in an IndexedVertexList? If > > > > > so, how? > > > > > Can I do this with a Pyglet Batch object? If so, how? > > > > > > Hope my question makes sense. Apologise if this is an obvious > > > > > question, but I'm very much 'example driven' and I'm having trouble > > > > > finding one that matches my problem. > > > > > Thanks for your time and help =) > > > > > > Cheers, > > > > > Adam > > > > > -- > > > > 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]<javascript:;> > > > > . > > > > To unsubscribe from this group, send email to > > > > [email protected] <javascript:;>. > > > > For more options, visit this group at > > > >http://groups.google.com/group/pyglet-users?hl=en. -- 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.
