pmartz / jag-3d

Automatically exported from code.google.com/p/jag-3d
0 stars 1 forks source link

VAO and multiple Programs #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Picture a rendering scenario that use one VertexArrayObject, but two Programs. 
On the first frame, the first Program gets bound, then the VAO is created and 
bound, but the vertex attrib pointers use locations queried from the first 
program. Then some drawing occurs. This all happens correctly.

Then, the second Program gets bound, and more drawing occurs. Note the VAO 
hasn't changed, so doesn't need to be bound again. Drawing will be correct as 
long as the locations of the vertex attribs are the same between the two 
programs.

If the locations are different -- say, vertices are location 0 in one program, 
and location 2 in another -- then rendering will not be correct.

This needs to be fixed.

There are two options:
1. Allow explicit vertex attrib location binding. The app would be responsible 
for making sure that all Programs use consistent locations for analogous data. 
This is a TBD enhancement.
2. Provide some other way for checking to see if locations have changed; if so, 
rebuild and rebind the VAO. This seems horribly inefficient.

We need to do option 1, that's a given. Option 2, dunno, we need some kind of 
design decision on whether it's needed or useful.

Original issue reported on code.google.com by SkewMat...@gmail.com on 26 Sep 2013 at 7:49