How to transform my project to 3d?

Hey Guys,
I have a project done in 2d …
but i want to do that in 3d too …
Is it a easy way to do it ??

The project is a graph project … with x and y axis , and the curve … just it


If you are already doing 2D in OpenGL, then yes, it is very easy. Then you just change your glVertex2f functions to glVertex3f and add a z component.

I assume your 2D program draws simple lines. Well you can easily draw lines in 3D.

However, drawing surfaces is a quite a bit more tricky. A single triangle or quad is easy, but a curving 3D surface like a hyperbolic-paraboloid, will need to be drawn by creating many triangles. If you can plot the verts on the surface you want, then you can use something like the “Marching Cubes” algorithm to connect all the points and create a solid surface. However these algorithms can not be perfect, and may connect verts that shouldn’t be connected.

So, yes if you are just drawing lines. No, if you are drawing surfaces.

Changing the camera angles, and dealing with perspectives can be difficult too for a novice. But there are many tutorials that can get you on your way in no time at all.

See the OpenGL Tutorials Page .