Thread: 3d cube

  1. #1
    vishal2001
    Guest

    3d cube

    how can i draw 3d cube and rotate it in about any of 3-axes???
    (in C-graphics)??
    Thanks in advance
    Code appreciated or at least describe the method.

  2. #2
    Registered User fry's Avatar
    Join Date
    Mar 2002
    Posts
    128
    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.
    IDE: Dev C++ 5
    Lib: Allegro
    OS: Windows 2000

  3. #3
    vishal2001
    Guest

    Question 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.

  4. #4
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    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.
    Away.

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571

    Re: help

    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.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2d Cubik program in C
    By joot43 in forum C Programming
    Replies: 4
    Last Post: 05-25-2009, 07:17 AM
  2. Odd 3D Invis Objects?
    By Zeusbwr in forum Game Programming
    Replies: 4
    Last Post: 12-07-2004, 07:01 PM
  3. 3D starfield
    By VirtualAce in forum Game Programming
    Replies: 6
    Last Post: 06-26-2003, 12:40 PM
  4. 3D SDK for C++ programmers
    By chand in forum Game Programming
    Replies: 2
    Last Post: 05-20-2003, 07:38 AM
  5. 3d engines
    By Unregistered in forum Game Programming
    Replies: 7
    Last Post: 12-17-2001, 11:19 AM