www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/18/03:23:28

Message-ID: <087a01bdfa59$efaa7140$ea023ace@alpha>
From: "Brian Bacon" <kyberteknik AT geocities DOT com>
To: <djgpp AT delorie DOT com>
Subject: Re: polygon texture with allegro
Date: Sat, 17 Oct 1998 22:41:15 -0700
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

Actually, Allegro limits the size of textures to powers of two (max 256x256
I think).  You can have a 256x128 or whatever, but not 320x240.  Linxman is
also correct, but I believe this is the real reason behind the problem.
Also, you dont have to create_bitmap() when you load_bmp(), you'll only end
up overwriting the pointer to memory you just allocated, with a pointer that
load_bmp() allocates.  Hence, you will have lost the pointer to the memory
you allocated (unless you copy it somewhere else, but that seems kinda
strange...), and you will not be able to free it until the program ends (as
far as I know.. maybe some system call could kill it, but I doubt it).
Hope that helps.....

-Brian

P.S. I see the same little mistake with allcating before loading over and
over again, but hardly anyone mentions it....

-----Original Message-----
From: Linxman <linxman AT polbox DOT com>
To: djgpp AT delorie DOT com <djgpp AT delorie DOT com>
Date: Saturday, October 17, 1998 1:31 PM
Subject: Re: polygon texture with allegro


>Hi,
>Texture size is 320x240 so max value for x is 319, and for y 239.
>Hope it helps!
>
>>I have a ploblem with allegro. I want apply a texture (2.bmp 320x240
>>16bit ) at one polygon. I did in following method.
>>Why it is wrong ?
>>How can I resolve this problem ?
>>
>>V3D_f v1,v2,v3,v4;
>>BITMAP *bmp,*texture;
>>PALETTE pal;
>>allegro_init();
>>bmp=create_bitmap(640,480);
>>texture=create_bitmap(320,240);
>>clear(bmp);
>>clear(texture);
>>set_color_depth(16);
>>set_gfx_mode(GFX_VESA1,640,480,0,0);
>>texture=load_bmp("2.bmp",pal);
>>v1.x=0;
>>v1.y=0;
>>v1.z=0;
>>v1.u=0;
>>v1.v=0;
>>v1.c=0;
>>
>>v2.x=320;
>>v2.y=0;
>>v2.z=0;
>>v2.u=320;
>>v2.v=0;
>>v2.c=0;
>>
>>v3.x=320;
>>v3.y=240;
>>v3.z=0;
>>v3.u=320;
>>v3.v=240;
>>v3.c=0;
>>
>>v4.x=0;
>>v4.y=240;
>>v4.z=0;
>>v4.u=0;
>>v4.v=240;
>>v4.c=0;
>>quad3d_f(bmp,POLYTYPE_ATEX,texture,&v1,&v2,&v3,&v4);
>>blit(bmp,screen,0,0,0,0,640,480);
>>
>>
>

- Raw text -


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