Mail Archives: djgpp/1998/12/23/20:04:38
Message-Id: | <199812240104.BAA14906@remus>
|
From: | "Arthur" <arfa AT clara DOT net>
|
To: | <djgpp AT delorie DOT com>
|
Subject: | RE: Could anyone explain ?
|
Date: | Thu, 24 Dec 1998 01:03:21 -0000
|
X-Priority: | 3 (Normal)
|
X-MSMail-Priority: | Normal
|
X-Mailer: | Microsoft Outlook 8.5, Build 4.71.2173.0
|
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3
|
In-Reply-To: | <01be2e00$2bf97900$882e28c1@dan>
|
Importance: | Normal
|
Reply-To: | djgpp AT delorie DOT com
|
> I'm trying to draw 3d-shapes with Allegro, but I haven't had any progress
> yet.
> The examples no. 22 and 26 are pretty complex and I don't understand them.
> Please could anyone give me lines, that would draw a triangle with the
> triangle3d
> function ?
>
> I tried things like this:
> int main()
> {
> BITMAP *bmp;
> V3D vtx1={10,10,250,0,0,0xD0};
> V3D vtx2={100,10,250,0,0,0xD0};
> V3D vtx3={10,100,250,0,0,0xD0};
> allegro_init();
> set_gfx_mode(GFX_AUTODETECT,800,600,800,600);
> set_projection_viewport(0, 0, SCREEN_W, SCREEN_H);
> triangle3d(screen,POLYTYPE_FLAT,NULL,&vtx1,&vtx2,&vtx3);
> getch();
> getch();
> return 1;
> }
>
> but I couldn't notice any output on the screen.
> What should I do ?
The first five elements of the V3D structure should be of type fixed. You
can ignore the fourth and fifth elements, since you're not using them.
Try this:
int main()
{
/* BITMAP *bmp; You don't use this BITMAP */
V3D vtx1={itofix(10),itofix(10),itofix(250),0,0,0xD0};
V3D vtx2={itofix(100),itofix(10),itofix(250),0,0,0xD0};
V3D vtx3={itofix(10),itofix(100),itofix(250),0,0,0xD0};
allegro_init();
set_gfx_mode(GFX_AUTODETECT,800,600,0,0);
set_projection_viewport(0, 0, SCREEN_W, SCREEN_H);
triangle3d(screen,POLYTYPE_FLAT,NULL,&vtx1,&vtx2,&vtx3);
getch();
getch(); /* You did want two of these, right? */
return 0; /* return 1 returns an error code */
}
James Arthur - jaa AT arfa DOT clara DOT net
http://www.jado.org/users/arfa/
ICQ#15054819
- Raw text -