views:

285

answers:

4

I am trying to cobble together a scene that basically consists of:

  1. A 2D image of the earth (think NASA satellite photography) that has been rotated into a view similar to this and,
  2. Cylindrical tubes that I want place at specific lat/lon coordinates.

I have managed to setup the 2d image as depicted in the link above, but I am struggling with creating the cylinders. The effect I am hoping to achieve should look something similar to this. Anyway, I realize this description isn't really a lot to go on, I guess that is because I know so little I am not sure what to ask :)

Any hints? Names of GL functions I should lookup would be especially useful. Oh yeah, I am using PyOpenGL in case that matters?

Thanks!

+1  A: 

This tutorial explains how to use quadratics to save time drawing objects in GL, there is an example of a cylinder closer to the bottom. This site is also a great learning resource for OpenGL overall. Although it uses C you can see the functions used and implement them as desired.

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=18

John T
Those nehe tutorials are really good to get jump started using opengl.
argonide
A: 

GLUT is a library which provides collections of opengl calls for commonly used behaviours, including creating basic shapes such as cylinders.

Once you manage to create a cylinder using GLUT, you can position the cylinders using matrix transforms to your desired location.

If you havent checked these out already they might be useful:

http://pyopengl.sourceforge.net/documentation/

http://www.opengl.org/documentation/red_book/

http://www.opengl.org/resources/libraries/glut/

Akusete
A: 

Thanks for the answers.

I have read the nehe tutorials, they are quite good. In fact, they are translated to python in the demos included in PyOpenGL. I guess my problem is more to do with setting attributes of the cylinder after I draw it, I should have been more specific, sorry. I am probably missing something simple but after several hours of trying I am coming up empty. I indeed did use the GLUT library and tried to draw a glutSolidSphere as a test. In my scene I cannot seem to make it colored like the rays I link to in the original post.

I guess a better question would have been what GL commands should I look to to produce effects as can be seen in the rays animation (link in OP).

Scott
+1  A: 

The video you supplied in the original post has a number of effects which you may or may not be trying to emulate.

GLU/GLUT created objects are created at the origin of your current modelview space, so you will need to translate/rotate/scale them to your desired location.

Look at glColor, to set the rendering color before you draw your cylinders.

for the transparency effect, a little extra work is required.

Look up 'blending', glEnable (GL_BLEND), glBlendFunc, to learn about the basics of transparency.

This HeNe tutorial might be useful: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=08

The one thing which may cause problems with rendering transparent images is that the order you draw images becomes important becuase of how z-buffer clipping and blending works. You might find that you will need to draw the cylinders in decreasing distance to your viewing location.

Akusete