Mail Archives: djgpp/1998/08/27/18:32:57
From: | "Dragon" <fire-dragon AT home DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Allegro - polygon3d
|
Lines: | 92
|
Message-ID: | <i_kF1.13862$hw1.5656699@news.rdc1.on.wave.home.com>
|
Date: | Thu, 27 Aug 1998 22:22:06 GMT
|
NNTP-Posting-Host: | 24.112.0.39
|
NNTP-Posting-Date: | Thu, 27 Aug 1998 15:22:06 PDT
|
Organization: | @Home Network Canada
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I'm trying to figure out how to do 3D with Allegro, but I can't get
polygon3D to work. The program compiles and runs ok, but doesn't display
the polygon:
#include <allegro.h>
//**************************
//GameInit()
//**************************
void GameInit(void)
{
allegro_init();
install_keyboard();
set_color_depth(8);
set_gfx_mode(GFX_AUTODETECT,640,480,640,480);
}
//*************************
//GameExit()
//*************************
void GameExit()
{
clear_keybuf();
while (!keypressed());
set_gfx_mode(GFX_TEXT,80,25,0,0);
printf("\n\n\n\n\n\n\n\nExit OK\n\n\n");
}
//*************************
//GameMain()
//*************************
void GameMain()
{
int i;
V3D ver[5],*p[5];
for (i=0;i<=5;i++)
p[i]=&ver[i];
BITMAP *buf,*tex;
buf=create_bitmap(640,480);
tex=create_bitmap(16,16);
clear(buf);
clear(tex);
putpixel(tex,5,8,20);
putpixel(tex,12,10,220);
ver[0].x=10; ver[0].y=10; ver[0].z=0;
ver[0].u=0; ver[0].v=0;
ver[0].c=155;
ver[1].x=23; ver[1].y=150; ver[1].z=0;
ver[1].u=0; ver[1].v=0;
ver[1].c=255;
ver[2].x=170; ver[2].y=25; ver[2].z=0;
ver[2].u=10; ver[2].v=5;
ver[2].c=200;
ver[3].x=400; ver[3].y=120; ver[3].z=0;
ver[3].u=4; ver[3].v=4;
ver[3].c=100;
putpixel(buf,10,10,10); //This pixel shows up ok
polygon3d(buf,POLYTYPE_GCOL,tex,3,p); //This does not appear on the
screen
blit(buf, screen, 0,0,0,0,640,480);
}
//*************************
//main()
//*************************
void main(void)
{
GameInit();
GameMain();
GameExit();
}
Any help greatly appreciated.
Fire Dragon
- Raw text -