View Full Version : How to draw a Umbrella, Bell or Hemisphere?
10-08-2009, 02:43 AM
Hi, I am trying to draw a very simple hemisphere, is there and algorithm around? any help will be much appreciated
10-13-2009, 04:53 AM
Your question belongs in the "beginners" forum, really, but here's the general method:
Loop over polar coordinates (latitude and longitude on the sphere) and use sine and cosine functions to generate the vertex coordinates. Then use sheer determination and force of will to sort out which coordinate indices should go with which triangles.
If you need code to get you started, look at glutSphere() in the open source Mesa implementation, or my simple OpenGL tutorial:
Look in "planets6.c" for the function "drawTexturedSphere". Note that my code is old and uses immediate mode rendering with glVertex(), which I do not recommend for modern OpenGL programming. You should use vertex arrays instead, but the math for the sphere coordinates is the same.
10-13-2009, 05:01 AM
Sorry, I misspelled the web address. It should read:
10-14-2009, 01:23 AM
Hi Stefan, I will check out that tutorial, thanks for the link, I also found the quickstrat guide very usefull aswell
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.