Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VertexArrayObject support #9

Open
axel22 opened this issue Feb 27, 2014 · 4 comments
Open

VertexArrayObject support #9

axel22 opened this issue Feb 27, 2014 · 4 comments

Comments

@axel22
Copy link
Member

axel22 commented Feb 27, 2014

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:

https://github.com/storm-enroute/macrogl/blob/master/src/test/scala/org/macrogl/examples/SingleTriangle.scala#L14

We need a better support for VAOs.
We must do the following:

  • introduce VertexArrayObject.scala, which extends Handle, and its acquire generates a name, just like Program, Texture, RenderBuffer and others
  • introduce object VertexArrayObjectObject { def foreach = ... } in using: 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 of using 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)
} {
@axel22
Copy link
Member Author

axel22 commented Dec 11, 2014

@storm-enroute-bot

3 similar comments
@axel22
Copy link
Member Author

axel22 commented Dec 11, 2014

@storm-enroute-bot

@axel22
Copy link
Member Author

axel22 commented Dec 11, 2014

@storm-enroute-bot

@axel22
Copy link
Member Author

axel22 commented Dec 11, 2014

@storm-enroute-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant