I have a bunch of 3d models I want to draw and also for some of them I want to draw bounding boxes. Calculating the boundnig boxes is no problem, but I'm not sure as to what is the best approach to rendering them.
I have a vertex and fragment shader for my 3d models and they contain a ton of information not needed to draw simple bounding boxes (textures, normals, etc) linked up in a program. Now I also want draw bounding boxes for each of the models meshes and I can think of two ways using two shader programs (one for 3d models and one for bounding boxes):
- after drawing each mesh change program to boundingbox and draw its boundingbox
- after drawing all meshes, change program to boundingbox and draw all boundingboxes for all meshes
I am inclined to believe the 2nd option is better, but is the overhead of glUseProgram significant enough to notice?