delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/13/10:36:38

From: qball1723 AT aol DOT com (QBall1723)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro: polygon3d( BITMAP*, int, BITMAP*, int, V3D* ) won't work!
Date: 13 Jan 1998 15:23:57 GMT
Lines: 56
Message-ID: <19980113152300.KAA10814@ladder01.news.aol.com>
NNTP-Posting-Host: ladder01.news.aol.com
Organization: AOL http://www.aol.com
References: <68l76p$52c AT nexus DOT nexus DOT edu DOT au>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>Can someone please tell me what in the heck is wrong with this code? It
>compiles all right, but the only thing on the screen is the line drawn by
>the putpixels in the loop - no square like what should be there. I've tried
>a variety of settings for the z co-ordinate too, and it didn't help.
>
>#include "allegro.h"
>int main()
>{
>        allegro_init();
>        install_timer();
>        set_gfx_mode( GFX_TRIDENT, 800, 600, 800, 600 );
>        BITMAP* buffer=create_bitmap( 800, 600 );
>        clear( buffer );
>        V3D* points=(V3D*)malloc( sizeof( V3D )*4 );
>        for( int i=0; i!=4; i++ )
>        {
>         points[i].z=0;
>                points[i].c=13;
>                points[i].u=points[i].v=0;
>                putpixel( buffer, i, i, 13 );
>                if( i==0 || i==3 )
>                     points[i].x=100;
>                else
>                     points[i].x=200;
>                if( i==0 || i==1 )
>                     points[i].y=100;
>                else
>                     points[i].y=200;
>        }
>        polygon3d( buffer, POLYTYPE_FLAT, NULL, 4, &points );
>        blit( buffer, screen, 0, 0, 0, 0, 800, 600 );
>        rest( 20000 );
>        exit( 0 );
>}
>
>As far as I can see, this should draw a square on the screen... but it
>doesn't. I suspect that I'm missing something large here and that polygon3d
>is not actually a perspective projection of the polygon, but I'm not sure
>about this. Maybe the allegro docs aren't quite clear on this?
>
>Thanks for taking the time to read this.
>
>Tom Cook
>
>

Textures for polygons MUST be powers of 2
(ie. 2x2, 4x4, 8x8, 16x16, 32x32, 64x64, 128x128, 256x256, 512x512...  which
would be pretty close to what you have....)

I hope this helps


Jim the loiterer (wannabe PC game/graphics developer)
http://members.aol.com/qball1723/index.htm
[please don't hate me because I pay too much for poor internet service!!]

- Raw text -


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