You'll need to pass the rotation into the vertex shader. The vertex shader is responsible for mapping your vertex coordinates to the screen.
First, this requires that you change some GLSL, adding a new uniform variable that is a rotation matrix.
Something like:
...
uniform rot mat4;
...
gl_Position = rot * vec4(point, 1.0);
...
This also changes the type of the vertex shader, so now, the model function enforces that you provide the rotation value. So you will need to add a field "rot" to the fourth parameter of the model function.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Right. The concept here is that you don't want to perform the rotation outside of the shader, but rather inside of the shader. This is because the graphics card will parallelize the multiplications of each vertex. So each game "tick" you would send the triangles and the updated rotation, which will probably change for each "tick".
Evan points out something important. It is rather expensive to re-bind the triangles to the internal buffers of your GPU. We do some caching under the hood such that if your triangles don't change, they get re-used. However, it is relatively cheap to send in new uniforms for each game "tick". So your triangles, also known as a mesh, are best instantiated once, and then moved and rotated using uniforms which change on each "tick".
Nope not a bug. Just possibly inefficient. For example, if one built a modeling tool, then you would need to be able update a mesh directly.
Oh yeah, weird and yes I missed that. Still just on my phone. I guess we can't yet put it on share-elm?
I'll be home soon to take a look.
I've opened an issue on github and will fix this