Picking/ particle effect

I have a bunch of spheres that i drew in open gl. I am trying to make it to where when the user clicks on one with the mouse it explodes. I am guessing i would use both picking and the particle effect for this?

Any sources online that could help with the code would be great.

[QUOTE=drew21;1286221]I have a bunch of spheres that i drew in open gl. I am trying to make it to where when the user clicks on one with the mouse it explodes. I am guessing i would use both picking and the particle effect for this?

Any sources online that could help with the code would be great.[/QUOTE]

it depends on how detailed (= complex) you want it to be:
“explosion” effects can be done using a bunch of textures, which you have to render to a primitive on the screen sequentially, or you use a “geometry shader” in which you transform each face of a (lets say) sphere away from the sphere center, in addition to that you rotate each face randomly (to make it appear “real”)

particles can be simulated on the gpu using either “transform feedback” or “compute shader”, otherwise you can do the particle simulation offline (on the cpu) which will be much slower
(a transform feedback example is described in the book “OpenGL Programming Guide 8th Edition”)
Google*
https://sites.google.com/site/john87connor/compute-shader/tu

to determine the 3D position where to do the explosion effect, you can do “raycasting” or “picking”, but there has to be a face under the cursor (otherwise you can only determine 2D position, without the depth)