Re: In the helloTriangle example can you explain the VertexData and its values and why bytes?
Posted by elect on Feb 13, 2016; 6:14am
URL: https://forum.jogamp.org/In-the-helloTriangle-example-can-you-explain-the-VertexData-and-its-values-and-why-bytes-tp4036213p4036216.html
Heya,
actually your questions are really good because they point out which are the doubt of beginners, then I am gonna update the HelloTriangle and this is what I add
Each line represents an interleaved vertex attribute array and they are
* counted starting from zero. This means the first line is vertex 0, the
* second vertex 1 and the last one vertex 2. Usually floats are used, but
* in this sample I went with bytes. They are interleaved because for each
* line, the first two bytes indicates the position while the last four the
* color of the i-th vertex. Take in account the positions are going to be
* used as they are but the colors are going to be, instead, normalized.
* Since I am going to load them as signed bytes they will be resolved in
* the range [-1, 1]. That is, in the shaders, a Byte.MAX_VALUE will
* correspond to a value equal to 1.