GL2 Vertex Shader Question,
Members - Reputation: 109
Posted 09 September 2012 - 06:56 PM
I need to write a small specialized application which is supposed to do the following:
1.) Buffer n arrays of m values
2.) Render a path such that each vertex consists of one value of three of those arrays
So it's like:
(1, 2, 3, 4)
(4, 3, 2, 1)
(1, 3, 2, 4)
(4, 2, 3, 1)
Now three arrays are choosen,lets pick 1, 2 and 3 in that order, so the vertices for the path are:
((1,4,1), (2, 3, 3), (3, 2, 2), (4, 1, 4))
Since the choosen arrays should be picked dynamically, and without delay, the values need to be buffered.
The thing is I need to use Opengl 2, so I started using VBO's.
But then, I'd need to buffer every Permutation of three arrays..
So I thought I could save the values of each array in a different buffer,
prepare the required amount of vertices (0, 0, 0) in a VBO,
and, using a vertex shader add the values in the choosen buffers.
So my question is, wether this is possible with GL2 shaders, and how could I access the buffers.
Basically I don't know a lot about shader programming, so some ressource about this
particular problem would be very helpful.