Jump to content
  • Advertisement
Sign in to follow this  
speiestaaim

OpenGL revolving a 2-d bitmap into 3-d object

This topic is 4967 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I am writing a simulation software. We are able to generate the 2-d shape of the object in our program. The final 3-d shape would be obtained by rotating this bitmap (upper half) by 360 degree around the x-axis. Is there any method in opengl using which we can do this. We have two options 1. rotate the bitmap itself. 2. generate a 2-d surface (using rectangles) by parsing the bitmap and then rotate this surface around the z-axis. The normal method of drawing, rotate by a small angle , draw again, ... will result in a very heavy object. Please help me out in this problem. Thanks for reading. Param Bir Singh

Share this post


Link to post
Share on other sites
Advertisement
if you are talking about the same method as in Alice3d or even VRML (I think) where you can make a 2D drawing from one side and have it fill the object in by generating the shape if the object was rotated on the y (or any other axis) by small increments then AFAIK there is no easy way to do this with OpenGL.

OpenGL deals with vertecies and polygons. The method of drawing rotate by a small angle and draw again, as you said, would result in slow performance.

When creating your 2D object i can see how you would be able to generate the data if your 2D drawing dealt with verts too (at some level) but with a totally random picture i'm guessing that would be extremely hard.

HTH

Share this post


Link to post
Share on other sites
Quote:
Original post by speiestaaim
I can find out the vertices, and use the polygon method in opengl to draw it. what after that?


Yeah if you have the vertecies and triangles/polygons you can draw it with OpenGL. Have a look at NeHe for openGL tutorials. You have a few options for drawing, Immediate mode (glVertex...) or vertex arrays (glVertexPointer...) which you can use with VBOs. All of it should be covered in the nehe tutorials.

What do u want to do after that?

Share this post


Link to post
Share on other sites
Quote:
Original post by speiestaaim
the vertices will give a 2-d object, how to revolve it into a 3-d object aroud z axis?

thanks for ur previous replies.


You will have to manually generate the vertecies from your 2d drawing. You would need to do the vertex rotations manually and then generate the triangles/polygons from the generated vertecies. Generating the triangles/polygons will depend on how you store your 2D data, you may be just able to connect the last angle and the new angle if you have some sort of edge/line or poly structure to the 2D drawing. If you draw your 2d object just as lines then the generation would be pretty easy (just gen 2 triangles for the line segment for 2 rotation points to form a quad). If not then it will be quite a bit more difficult, you would need to do some sort of edge detection to generate the triangles (the way this is implemented again depends on how you store your 2d data).

I suggest starting off with just generating the 3d vertecies with the rotations and drawing them as points before worring about generating triangles for it.

HTH

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!