OpenGL Planets

A question was posted on the Real Studio forum about rotating spheres in OpenGL. I remembered that the “red book” had an example of doing this. So I whipped up a little port of the demo. Some code from the red book is listed here. Site Here ..

The brown sphere represents a planet, the blue, smaller planet spins around the other one.  I added depth testing so the blue planet is not drawn as it goes behind the brown one. I’m on a Mac, you’ll have to see if it runs on your PC. :-) If you click on the window, the animation will toggle.
Download Project Here …

About bigdaddytom

Hobbyist programmer, self taught, started with Rb in 1999. Xcode, Objective-C iPhone coder too. I have been blessed being able to live in Hawaii for over three decades. Proud father of two. Business owner. The above image is from atop Mauna Kea looking towards Mauna Loa on the big Island of Hawaii.
This entry was posted in Code. Bookmark the permalink.

2 Responses to OpenGL Planets

  1. Massimiliano says:

    Hi, All your works a re very interesting. I’m curios and I would to know if there is any possibility with open gl to show molecular particles in a 2D and 3D view, maybe with some mouse interaction by the canvas container.
    All the best,
    Massimiliano.

    • bigdaddytom says:

      Yes. It’s very common to use OpenGL in this manner. There is quite a lot of work to get to this stage however. OpenGL is just a renderer, you’d have to feed it all of the model data and write “picking” code for the mouse to rotate the molecule. Google it. :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>