It appears you are correct. It ought to read:
pyglet.graphics.draw_indexed(2, pyglet.gl.GL_POINTS,
[0, 1],
('v2i', (10, 15, 30, 35))
)
I checked the implementation of draw_indexed, and with [0, 1, 2, 3] as the
indices argument Pyglet is allocating extra array space and passing it to
OpenGL, which appears to be very courteously ignoring the extra indices
provided.
I also found that Richard Thomas already committed a fix to the
documentation in the repository (but it probably won't be updated on the
web site until they release 1.2 for reals.
~ Nathan
On Thu, Dec 20, 2012 at 11:56 AM, Buck Golemon <[email protected]>wrote:
> In this example, from the programming guide[1], the indexes 2 and 3 don't
> seem to be doing anything useful. I can remove them and the output doesn't
> change, or change them to 5 and 6 with no effect. It seems like the writer
> got slightly confused and was trying to index the coordinates rather than
> the vertices? I believe the 2 and 3 are out-of-bounds indexes, and gl is
> igoring them rather than throwing an error, which surprises me, but I'm not
> at all experienced.
>
> Please correct me if I'm wrong.
>
> Vertices can also be drawn out of order and more than once by using the
>> pyglet.graphics.draw_indexed<http://www.pyglet.org/doc/api/pyglet.graphics-module.html#draw_indexed>
>> function.
>> This requires a list of integers giving the indices into the vertex data.
>> The following example draws the same two points as above, but indexes the
>> vertices (sequentially):
>>
>
>
> pyglet.graphics.draw_indexed(2, pyglet.gl.GL_POINTS,
>> [0, 1, 2, 3],
>> ('v2i', (10, 15, 30, 35))
>> )
>
>
> [1] http://www.pyglet.org/doc/programming_guide/drawing_primitives.html
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pyglet-users/-/YoYVgxX_nGoJ.
> 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.
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.