Closed gepbird closed 4 years ago
The proposed DrawProgram
method does the same as calling Draw
. Draw
is more efficient as it uses Gl.BindVertexArray(ID);
with OGL3 whereas DrawProgram
always uses BindAttributes(program);
. In the cases where the VAOs own shader is used, the user should use Draw
.
Unless i am missing something, then the only thing adding DrawProgram()
does is make it possible to draw slower.
You're right, it does the same thing as Draw
. It's a bit weird to me that I need to use a field from an other class.
How about making that field private and using a method instead? https://github.com/giawa/opengl4csharp/pull/40/commits/1d89a9ff701c60931831acfba7fe69ace63ee74d
These are public to allow the user to override the draw methods while still having a convenient container. Great care has to be taken to remove anything that was previously public, as some user code may rely on this. For that reason, unless there is some other recommendation, I think it's okay to close this issue for now. Let me know if you would like it re-opened to explore a different path.
VAO
has aDrawProgram(ShaderProgram)
function. Since theShaderProgram
in theVAO
is already known by the constructor, it'd make sense to use that. I added aDrawProgram()
to do exactly that.