Mail Archives: djgpp/1997/12/29/10:15:44
From: | nv95olbj AT klippan DOT se (Olof Bjarnason)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | textures in Allegro
|
Date: | Mon, 29 Dec 1997 14:25:10 GMT
|
Organization: | Klippans Gymnasieskola, Sweden
|
Lines: | 51
|
Message-ID: | <34a7b00b.6942920@news.klippan.se>
|
NNTP-Posting-Host: | ppp205.klippan.se
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I just wondered if anyone could help me on a little problem with
Allegro's texture handling. It would be very appreciated :).
I can't get Allegro's polygon3d() to work :(. Could anyone tell me
what is wrong with this code?
/**** 3d_test.c ****/
#include <stdio.h>
#include <allegro.h>
BITMAP *texture;
V3D v3d[4];
int main(void)
{
PALETTE newpal;
int ad = 5, i;
char buf[80];
allegro_init();
install_keyboard();
v3d[0].x = 0xFFFFFF; v3d[0].y = 0xFFFFFF; v3d[0].z = 170;
v3d[1].x = 0x1FFFFFF; v3d[1].y = 0xFFFFFF; v3d[1].z = 170;
v3d[2].x = 0x1FFFFFF; v3d[2].y = 0x1FFFFFF; v3d[2].z = 170;
v3d[3].x = 0xFFFFFF; v3d[3].y = 0x1FFFFFF; v3d[3].z = 170;
v3d[0].u = v3d[0].v = v3d[0].u = v3d[0].v =
v3d[0].u = v3d[0].v = v3d[0].u = v3d[0].v = 0;
texture = load_bitmap("3d_test.pcx", newpal);
// "3d_test.pcx" is a 99x99 8bit image
if(!texture) exit(1);
set_gfx_mode(GFX_VESA1, 640, 480, 0, 0);
clear(screen);
set_palette(newpal);
set_projection_viewport(0, 0, 640, 480);
draw_sprite(screen, texture, 0, 0);
quad3d(screen, POLYTYPE_PTEX, texture, &v3d[0], &v3d[1],
&v3d[2], &v3d[3]);
// ... this will only produce a one-colored polygon!
readkey();
destroy_bitmap(texture);
}
/********/
And BTW, how is the Z-coordinates measured? Not as the X- and
Y-coordinates, I figure at least (from checking EX22.C about
polygon3d()).
Thankful for help,
/Olof
- Raw text -