Austin503 / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

GL_TRIANGLE_FAN not handled properly by allocation module #619

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. batch.add(4, GL_TRIANGLE_FAN, None, *data)
2. batch.add(12, GL_TRIANGLE_FAN, None, *other_data)
3. batch.draw()

pyglet 1.1.4

batch.draw() will draw the 16 vertices as if they were a part of a single 
TRIANGLE_FAN instead of two isolated fans.

Temporary Workaround:
This works for my project, but in general it's a bad fix:
In the Allocator.alloc(), I added a force_newstart argument which defaults to 
False.  If True, it appends a new size and start to the sizes and starts lists. 
 Otherwise, it behaves the same.  Then in batch.add, if mode == 
GL_TRIANGLE_FAN, then it will call _safe_alloc with force_newstart=True, etc. 
etc. 

This doesn't work for reallocation.  I assume the same issue arises with the 
usage of GL_LINE_LOOP and other similar modes. 
Basically, the Allocator needs to set a new start even though there's no gaps 
in the block of memory allocated. 

Original issue reported on code.google.com by jacob.v....@gmail.com on 26 Nov 2012 at 7:21

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I am confirming that GL_LINE_LOOP also causes this issue :'(

Original comment by jacob.v....@gmail.com on 3 Aug 2013 at 2:14

GoogleCodeExporter commented 8 years ago
This issue is a know limitation of the pyglet graphics api specified on 
http://www.pyglet.org/doc/api/pyglet.graphics-module.html

It doesn't look like this will be fixed anytime :-(

* * *

Because of the way the graphics API renders multiple primitives with shared 
state, GL_POLYGON, GL_LINE_LOOP and GL_TRIANGLE_FAN cannot be used --- the 
results are undefined.

[...]

Alternatively, the NV_primitive_restart extension can be used if it is present. 
This also permits use of GL_POLYGON, GL_LINE_LOOP and GL_TRIANGLE_FAN. 
Unfortunatley the extension is not provided by older video drivers, and 
requires indexed vertex lists.

Original comment by j.sebast...@gmail.com on 9 Nov 2013 at 7:28

GoogleCodeExporter commented 8 years ago

Original comment by useboxnet on 1 Dec 2013 at 8:34