hi

I want to define 3d cube with x,y,z coordinate. I actually want to define 8 point and draw lines between them to paint 3d cube. I also want to define the perspective.

How can I draw this cube on screen? I know I have to translate the x,y,z to x,y screen.

thank very much

dan

I think the first place you should start is this web site: nehe.gamedev.net

Read the tutors on the basics of how to program which openGL, there is also examples of how to make a 3D cube.

Originally posted by dyahav:

hi

I want to define 3d cube with x,y,z coordinate. I actually want to define 8 point and draw lines between them to paint 3d cube. I also want to define the perspective.

How can I draw this cube on screen? I know I have to translate the x,y,z to x,y screen.

thank very much

dan

thank for your answer!

I know this site but Im looking for the formula to calculate the new points after changing the perspective of the cube.

I know that opengl does the calculation but I wany to know how. and I want to do it myself.

thanks

dan yahav

Ok, for the math part to a google search for 3D math, I have found a few good sites out there. But don’t have a link handy.

Originally posted by dyahav:

thank for your answer!

I know this site but Im looking for the formula to calculate the new points after changing the perspective of the cube.

I know that opengl does the calculation but I wany to know how. and I want to do it myself.

thanks

dan yahav

You want to have a look at the book “Linux 3D Graphics Programming” by Norman Lin. He works right from the ground up (using Xlib) and writes C++ classes that do things that OpenGL does. He specifically covers the perspective projections (in chap.5) that you’re asking about.

[This message has been edited by jmg (edited 10-11-2002).]

You can search for perspective projection on google and find all kinds of texts, matrices and drawings that explains to you, how to do this.

A better approach might be to spend a couple of hours at your local University Library(engineering), looking over chapter6 in

“Computer Graphics: Principles & Practice” by Foley. This book is old and almost always available.

Mathias

How about looking at the OpenGL spec? It gives formulas for rotation, translation, scaling, and projection matrices. It doesn’t talk about the physical significance of the matrices, but if all you want to know is how to calculate the matrices, this is the way to go. Just look at the Coordinate Transformations section.