Hi, I am trying to figure out how to pass in an array of of3dPrimative objects into a vertex shader using drawInstanced and then set the position of each object in a unique position so they are not overlapping each other. I’ve spent a week trawling through examples but everything seems to only use one 3d primitive.
For example, in the image below i’m calling draw instanced on a cube and a sphere and then setting the positions into a grid using gl_instanceID in the vertex shader… What I want to be able to do is say:
if (gl_InstanceID % 2 == 0) drawSphere();
if (gl_InstanceID % 2 == 1) drawCube();
Is there any way of distinguishing between the different objects in the vertex shader to do this? Thanks.