-
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 itsacquire
generates a name, just likeProgram
,Texture
,RenderBuffer
and 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
foreach
and a macro associated, just like with other kinds ofusing
objects - 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