# 3d cube

• 09-14-2002
vishal2001
3d cube
how can i draw 3d cube and rotate it in about any of 3-axes???
(in C-graphics)??
Code appreciated or at least describe the method.
• 09-14-2002
fry
Quote:

in C-graphics
You will need to use an graphics API of some description. There is no such thing as "c graphics".

If you know a lot about graphics, then look at OpenGL or DirectX tutorials. If u havent done any graphics before, maybe learn something simpler, like Allegro. You should get into learning about 2d thoroughly before you move into the advanced 3d concepts.
• 09-14-2002
vishal2001
help
hi,
by c graphics i mean using 3d transformations matrices and <graphics.h> functions i want to rotate a cube around vertical y-axis.
Now problem is how can i implement a third axis for drawing a cube??
Once this is established rotation thing is easy as i know a matrix
by which it can be rotated.But problem is how to implement
cube with 3axes geometry in c using line() etc. functions.
• 09-14-2002
confuted
well, there are a lot of tutorials about this online. I would suggest searching for the following:

Denthor of Asphyxia
3DICA

the first one is hewavily outdated and has a couple of flaws, but the theory is still good, and *most* of the math works.

3DICA is very nice, though.
• 09-25-2002
MrWizard
Re: help
Quote:

Originally posted by vishal2001
hi,
by c graphics i mean using 3d transformations matrices and <graphics.h> functions i want to rotate a cube around vertical y-axis.
Now problem is how can i implement a third axis for drawing a cube??
Once this is established rotation thing is easy as i know a matrix
by which it can be rotated.But problem is how to implement
cube with 3axes geometry in c using line() etc. functions.

Look up perspective matrices and you will find your answer. Also might want to look up some linear algebra primers and such. Then you can use GDI and use pixels as vertices and LineTo for the lines connecting them, or a triangle filler if you want. I have done all of this using Software Rendering only. I also wrote my own Vector/Matrix library to utilize.