delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/03/07:45:32

From: "Tom Cook" <tcook AT nexus DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro: polygon3d( BITMAP*, int, BITMAP*, int, V3D* ) won't work!
Date: Sat, 3 Jan 1998 20:47:21 +0930
Organization: Nexus Information Service
Lines: 45
Message-ID: <68l76p$52c@nexus.nexus.edu.au>
NNTP-Posting-Host: nexus.nexus.edu.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


- Raw text -


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