Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch.migrate IndexedVertexList #760

Open
GoogleCodeExporter opened this issue Apr 6, 2015 · 4 comments
Open

Batch.migrate IndexedVertexList #760

GoogleCodeExporter opened this issue Apr 6, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

I am working on creating a 3d graphics engine and using the concepts behind 
sprite.Sprite and the graphics.py demo to create a 3d set of primitive objects 
(using pyglet 1.1.4 btw).  

Now to implement picking I want to be able to change the group the primitive 
belongs to.  Based on sprite.Sprite, changing groups basically calls 
self._batch.migrate(self._vertex_list, GL_QUADS, self._group, self._batch).  
Note that self._vertexlist in sprite.Sprite is not an indexed list (see 
Sprite._create_vertex_list).  When I try to do the same thing with an indexed 
vertexlist in my 3d engine I am getting some strange behavior. Looking at 
Batch.migrate in pyglet\graphics\__init__.py it seems that the 
batch._get_domain function is always called with False as the first argument, 
indicating that it's a regular vertexlist.  Therefore IndexedVertexList are not 
supported as issue 603 mentions.  

Taking a closer look at pyglet.graphics.vertexdomain revealed that 
IndexedVertexLists do not have .migrate method overloaded to account for the 
index buffer similar to .resize.  I took the concepts in VertexList.migrate and 
IndexedVertexList.resize and came up with the solution at the link provided 
below.  Here is the link to the repository and changes I made.

https://code.google.com/r/denisg640-pyglet/source/detail?r=f3d9a9a1e5d834731350e
fed71a606a807343768

Let me know if this solves issue 603.

Original issue reported on code.google.com by denisg...@gmail.com on 28 Aug 2014 at 6:13

@GoogleCodeExporter
Copy link
Author

Version 1.1.4 is considered final, the development is happening in 1.2. I can 
only suggest you to try 1.2 from repository and see if that works for you 
(although it implies some API changes).

Original comment by useboxnet on 31 Aug 2014 at 7:09

  • Changed state: Blocked

@GoogleCodeExporter
Copy link
Author

I took a look and found that the development version has the same issue as 
version 1.1.4.  Note that I applied the patch to the dev to begin with. As I 
mentioned, the problem is that IndexedVertexList.migrate method is not 
overloaded to account for indices.  It is calling the superclass (VertexList) 
migrate method by default.

Denis

Original comment by denisg...@gmail.com on 2 Sep 2014 at 1:09

@GoogleCodeExporter
Copy link
Author

Thanks Denis, good stuff.

Original comment by useboxnet on 2 Sep 2014 at 5:53

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

I fixed a few bugs with the previous patch. 

1. The index numbering has to be changed if an idx_vlist is migrated if the 
vertex attributes move to a different location on the vertexbuffer and 

2. Batch.migrate should set Batch._draw_list_dirty = True.

https://code.google.com/r/denisg640-pyglet/source/detail?r=cc8ff7f03ae70464b61e6
6b7e233c8a0a43dbc42

Denis

Denis

Original comment by denisg...@gmail.com on 4 Oct 2014 at 1:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant