: Hai all,
:
: I am initiating a simple project in 3D graphics.I want to do
: the following things:
:
: 1)creating a simple square in 3D
: 2)Move the sqaure to the given final position through
: some intermediate position already given.
:
: Please give your suggestions to do these things.
:
:
I am giving code for 3D square in turbo c
/* Program for 3D square
By:
Mitul Golakiya
E-Mail ID : mitulgolakiya@yahoo.com
mitul.gorkiya@avinashi.com
*/
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <iostream.h>
void main()
{
int x = 250, y = 200;
int gd = DETECT, gm;
initgraph(&gd, &gm, "E:\\TC\\BGI");
moveto(x, y+100);
lineto(x, y);
lineto(x+25, y-25);
lineto(x+125, y-25);
line(x, y, x+100, y);
line(x, y+100, x+100, y+100);
moveto(x+100, y);
lineto(x+100, y+100);
lineto(x+125, y+75);
lineto(x+125, y-25);
lineto(x+100, y);
setlinestyle(2, 1, 1);
line(x+25, 175, x+25, y+75);
line(x+25, 275, x, y+100);
line(x+25, 275, x+125, y+75);
getch();
getch();
closegraph();
}
Attachment:
3DVIEW.CPP
(641 Bytes |
downloaded 242 times)