cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/29/10:15:32

From: nv95olbj AT klippan DOT se (Olof Bjarnason)
Newsgroups: comp.os.msdos.djgpp
Subject: textures in Allegro
Date: Mon, 29 Dec 1997 14:40:09 GMT
Organization: Klippans Gymnasieskola, Sweden
Lines: 56
Message-ID: <34a7b546.8281377@news.klippan.se>
Reply-To: nv95olbj AT klippan DOT 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 am trying to build a 3d-graphics game a la BlackCrypt/Eye of the
Beholder/Hired Guns and to generate the block-textures I want to use
Allegro's polygon3d() function. The problem is: I don't get
polygon3d() to work :(. Please, could you 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 99x99x256 image
	if(!texture) { cprintf("error! (%ld)", texture); readkey();
exit(1); }
	set_gfx_mode(GFX_VESA1, 640, 480, 0, 0);
	clear(screen);
	set_palette(newpal);
	vsync();
	set_projection_viewport(0, 0, 640, 480);
	draw_sprite(screen, texture, 0, 0);
// only for verification of working image
	quad3d(screen, POLYTYPE_PTEX, texture, &v3d[0], &v3d[1],
&v3d[2], &v3d[3]);
// will only produce a only-colored polygon!
	readkey();
	destroy_bitmap(texture);
}
/********/

How are the Z-coordinates measured? Not as the X- and Y-coordinates, I
figure at least (from checking EX22.C about polygon3d()).

Thankful for any help,


/Olof

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019