View Full Version : 3d calculation - question

dyahav

10-11-2002, 11:48 AM

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

nexusone

10-11-2002, 11:52 AM

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

dyahav

10-11-2002, 01:19 PM

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

nexusone

10-11-2002, 06:52 PM

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).]

roffe

10-12-2002, 11:29 AM

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

*Aaron*

10-12-2002, 01:23 PM

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.

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.