-
-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
Description
https://github.com/Pure-D/code-d/blob/master/templates/EmptyOpenGL_SDL/source/app.d#L170
You are using vertex array object(VAO) here. It stores all the necessary information for drawing. There's no need to re-enable attribute arrays and respecify their format.
You can move the following code to loadscene
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, // attribute 0. No particular reason for 0, but must match the layout in the shader.
3, // size
GL_FLOAT, // type
false, // normalized?
0, // stride
null // array buffer offset
);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, colorBuffer);
glVertexAttribPointer(1, // attribute 1
3, // size
GL_FLOAT, // type
false, // normalized?
0, // stride
null // array buffer offset
);
when rendering, simply...:
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, 3);