Merging 2D images via PyOpenGL

I am trying to merge a scene consisting mainly of:

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

I was able to set a 2d image as shown in the link above, but I am struggling with generating cylinders. The effect I hope to achieve should look something like this . Anyway, I understand that this description is not really very much, I think it is because I know so little that I am not sure what to ask.

Any hints? The GL function names I should be looking for would be especially helpful. I am using PyOpenGL in case it matters.

0


source to share


4 answers


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



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

+1


source


GLUT is a library that provides collections of opengl calls for commonly used behaviors, including creating basic shapes like cylinders.

Once you manage to create the cylinder using GLUT, you can place the cylinders using the transform matrix to the desired location.

If you haven't, they might be helpful:



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

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

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

+1


source


The video you put in the original post has a number of effects that you may or may not try to simulate.

The created GLU / GLUT objects are created at the beginning of your current model viewspace, so you will need to translate / rotate / scale them to the desired location.

Look at glColor to set the render color before drawing your cylinders.

a little extra work is required for the transparency effect.

See "blending", glEnable (GL_BLEND), glBlendFunc for the basics of transparency.

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

The only thing that can cause problems with rendering transparent images is that the order you draw with the images becomes important because it works like cropping and mixing a z-buffer. You may find that you need to draw the cylinders at a reduced distance to the viewing position.

+1


source


Thanks for answers.

I read the tutorials, they are not bad. In fact, they are translated to python in the demos included in PyOpenGL. I guess my problem is with setting the cylinder attributes after I draw it, I should have been more specific, sorry. I probably missed something simple, but after hours of trying, I come up empty. I actually used the GLUT library and tried to draw glutSolidSphere as a test. In my scene, I can't seem to get it colored like the rays I referenced in the original post.

I think the best question would be what GL commands should be looking for to create effects that can be seen in ray animation (link in OP).

0


source







All Articles