safee's picture

draw multiple spheres of random sizes in opentk control


I would like to draw spheres in random positions using the opentk control.

I saw the example at

However, it only makes 1 sphere, which is hard to move or resize.

Any ideas?



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Robmaister's picture

If you want to make the spheres move, generate a random number and call GL.Translate() before drawing it. If you are using the Matrix4 class to store transformations, just multiply it by Matrix4.CreateTranslation().

As for resizing, you could modify the sphere generation code to accept a radius variable, which would essentially just be multiply all the vertices by your radius.

safee's picture

Thanks! Its working nicely now!