-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
VAOs are used as a shorthand for setting the state of the vertex processor, and, once the vertex attributes and pointers are set while a VAO is bound, subsequently binding the VAO does not require setting the vertex attribute buffers and pointers.
Right now, in the single triangle example, we access VAOs using the low-level OpenGL API:
We need a better support for VAOs.
We must do the following:
- introduce
VertexArrayObject.scala, which extendsHandle, and itsacquiregenerates a name, just likeProgram,Texture,RenderBufferand others - introduce
object VertexArrayObjectObject { def foreach = ... }inusing: https://github.com/storm-enroute/macrogl/blob/master/src/main/scala/org/macrogl/package.scala#L115 - have a
foreachand a macro associated, just like with other kinds ofusingobjects - it sets and unsets the VAO - add a
def vertexArrayObject(vao: VertexArrayObject) = VertexArrayObjectObject
This should allow the following syntax:
val vao = new VertexArrayObject
vao.acquire()
// loop
for {
_ <- using.vertexArrayObject(vao)
... all the rest ...
} {
// rendering
}
// later
vao.release()
Then, I would create a lazy default VAO lying somewhere in package.scala:
Default.VAO
So that the developers can fetch it immediately without creating it:
for {
_ <- using.vertexArrayObject(Default.VAO)
} {
Metadata
Metadata
Assignees
Labels
No labels