Mail Archives: djgpp/1998/03/31/21:07:32
From: | Vic <tudor AT cam DOT org>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: vvvvvvvvvvv Triangle3d help. vvvvvvvvvvvv
|
Date: | Mon, 30 Mar 1998 18:45:37 +0300
|
Organization: | Communications Accessibles Montreal, Quebec Canada
|
Lines: | 39
|
Message-ID: | <351FBE21.6DC@cam.org>
|
References: | <35215BBC DOT BB679B45 AT arrakis DOT es>
|
NNTP-Posting-Host: | dialup-811.hip.cam.org
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
DrDoom wrote:
>
> Could someone tell me what is wrong with this?
> I'm only trying to draw a 3d-triangle on the screen.
> The source have no errors but... i can't see anything.
V3D and triangle3d work with FIXED point numbers. You have to either
1) convert your numbers to fixed point ( itofix() or ftofix() ) OR
2) use floats, and the V3D_f struct and triangle3d_f function
try this instead:
#include <stdio.h>
#include "allegro.h"
int main(){
V3D_f v1={1,1,1,0,0,9},v2={1,100,6,61,13,100},v3={100,1,50,31,15,90};
BITMAP *b=create_bitmap(64,16);
allegro_init();
install_keyboard();
install_mouse();
install_timer();
set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0);
set_pallete(desktop_pallete);
clear_to_color(screen,3);
clear_to_color(b,100);
show_mouse(screen);
line(b,1,1,30,10,3);
line(b,1,12,30,1,3);
triangle3d_f(screen,POLYTYPE_ATEX,b,&v1,&v2,&v3);
do{;}while (!key[KEY_ESC]);
destroy_bitmap(b);
return 0;
}
--
--> http://www.cam.org/~tudor <--
- Raw text -