Ricardo Sanchez

10-08-2009, 03:43 AM

Hi, I am trying to draw a very simple hemisphere, is there and algorithm around? any help will be much appreciated

Cheers

rS

Cheers

rS

View Full Version : How to draw a Umbrella, Bell or Hemisphere?

Ricardo Sanchez

10-08-2009, 03:43 AM

Hi, I am trying to draw a very simple hemisphere, is there and algorithm around? any help will be much appreciated

Cheers

rS

Cheers

rS

StefanG

10-13-2009, 05: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:

http://www.itn.liu.se/~stegu/OpenGLQuickstart/

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.

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:

http://www.itn.liu.se/~stegu/OpenGLQuickstart/

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.

StefanG

10-13-2009, 06:01 AM

Sorry, I misspelled the web address. It should read:

http://www.itn.liu.se/~stegu/OpenGLquickstart/

http://www.itn.liu.se/~stegu/OpenGLquickstart/

Ricardo Sanchez

10-14-2009, 02:23 AM

Hi Stefan, I will check out that tutorial, thanks for the link, I also found the quickstrat guide very usefull aswell

Cheers

rS

Cheers

rS

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.