LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


Building a Black Hole With OpenGL

by Chris Halsall
09/15/2000

This article and accompanying program are dedicated to Stephen Hawking, one of the greatest explorers of our time. His book A Brief History of Time is a must read for anyone interested in the universe in which we find ourselves.

Related Articles:

Creating Real Time 3D Graphics With OpenGL

OpenGL Rendering and Drawing

Preparing to Build an OpenGL Application


Previous Features

More from the Linux DevCenter

Black holes might be considered the ultimate heroes of gravity. They have incredible density and generate such powerful gravitational fields that not even light can escape their proximity. Black holes were first suggested as early as the late 1700s and were made famous with Einstein's law of general relativity.

A black hole is so compressed that it folds space and time around itself. To the outside observer, it no longer has size and becomes a zero-dimensional singularity. If any physical size is at all meaningful when speaking about a black hole, it would be its event horizon -- the sphere around the singularity from which nothing will ever been seen again.

Invite 1000 particles to play around a black hole, and you just know things are going to get crazy.

Invite 1000 particles to play around a black hole, and you just know things are going to get crazy.

Only as recently as the mid-1970s were the effects best explained by black holes first observed, thus providing direct physical evidence of their existence. But they have been generally accepted by both the public at large and by scientific communities for decades, thereby becoming a favorite resource for both sci-fi story teller and theoretical physicist. Black holes are just so extreme -- literal points of no return.

Because of the incredible gravitational field a black hole generates, the space around it tends to be a very dynamic place. Any particle with mass that enters the orbit of the black hole will quickly accelerate as its orbit decays and the particle moves closer to the black hole itself. The gravity shear, or gradient, is also unique in that the force of gravity exists at different strengths at only slightly different distances from the black hole. Objects are either torn apart immediately, or end up spinning at high speeds and are ripped apart because of centripetal forces.

Even light particles (photons) that pass near the black hole, but outside its event horizon, will still be affected. Light bends around the singularity as a function of the inverse of its distance -- or -- the closer it is, the more it bends. Black holes can be thought of as gigantic lenses. There have been recent astronomical observations of distant starlight bending around what is assumed to be a black hole that happens to be in between ourselves and the more distant star.

You can build a black hole with OpenGL

It has been estimated that a hydrogen bomb made with all the water on the planet would likely cause the matter in the center of the bomb to be compressed into a black hole. While we wait for the accounting department to reject our request, we might as well look for another way to have some fun with black holes that might cause less of a stir.

Drawing the axis lines.

Drawing the axis lines.

Program and Makefile

• bhole.c - The OpenGL Black Hole simulator.

• Makefile - Simple Makefile.

What we can do fairly inexpensively is simulate the physics of a very strong gravity field acting upon a number of particles. By simulating a thousand particles or so, a very pleasing visual display can be created. Using a simple iterative solution, the physics can be calculated quickly, while still resulting in true "Kepler" orbits, within limits.

We'll use OpenGL as the 3D API in order to leverage any 3D hardware that might be available on the machine. Some basic understanding of OpenGL is assumed in this article. For an OpenGL refresher, please see these articles. The accompanying program is similarly structured as well.

Pages: 1, 2, 3, 4, 5

Next Pagearrow




Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!


Linux Resources
  • Linux Online
  • The Linux FAQ
  • linux.java.net
  • Linux Kernel Archives
  • Kernel Traffic
  • DistroWatch.com


  • Sponsored by: