Is there any way to get the current index from within the vertex shader?
as a simple example:
say we have an array with 8 values.
float vboarray[8]
These get passed to gl as a vbo array.
in the vertex shader, I would like to be able to identify the index of the shader.
ie.
main(){
glPosition.x = getPositionX(currentIndex);
glPosition.y = getPositionY(currentIndex);
glPosition.z = getPositionZ(currentIndex);
}
I’m implementing a LOD that has tiled (sort of) hightmaps, and would like to avoid sending xyz coords. I would like to send just Z and one xy per tile, the rest of the coords in the tile would calculate their xy based on the index and the xy for the tile.