www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/04/18:00:05

From: "23yrold3yrold" <cbarry AT pangea DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: One little polygon, that's all I ask....
Date: Mon, 4 Sep 2000 16:27:42 -0500
Lines: 76
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: 64.4.88.86
Message-ID: <39b41379_2@spamkiller.newsfeeds.com>
X-Trace: 4 Sep 2000 16:26:17 -0500, 64.4.88.86
X-Comments: This message was posted through Newsfeeds.com
X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support, spam or any illegal or copyrighted postings.
X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!!
X-Report: Please report illegal or inappropriate use to <abuse AT newsfeeds DOT com> You may also use our online abuse reporting from: http://www.newsfeeds.com/abuseform.htm
X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS)
Organization: Newsfeeds.com http://www.newsfeeds.com 73,000+ UNCENSORED Newsgroups.
Path: news.mv.net!newspeer.phoen-x.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.usenet-edu.net!usenet-edu.net!local-out.newsfeeds.com!newsfeeds.com!spamkiller.newsfeeds.com!newsfeeds.com!spk!anonymous!127.0.0.1!spk!64.4.88.86
Xref: news.mv.net comp.os.msdos.djgpp:103164

Hello. I've recently been learning more and more about 3D theory (sin, cos,
CrossProduct, DotProduct, BSP's, matrices, etc.) but I can't get Allegro to
display a single bloody polygon. The tutorials the library comes with are
not a huge help; they're filled with pointers to the point of confusion (are
those truly necessary?) and set up for those random rotations and such. All
I really want at the moment is little more than the bare code needed to
display a few polys so I can play with the matrices etc. to make sure I know
this stuff. How many functions have defaults so they don't have to be called
(eg. persp_project(), set_projection_viewport(), get_camera_matrix() etc)?
if someone could take a moment to draw this out for me I would very much
appreciate it. I've included code for (trying to) display a 3D polygon. It
compiles and runs fine, but it's just a blank screen. Can anyone show me
what I'm doing wrong? Thank you.

#include <allegro.h>

BITMAP          *DBL_BUFFER;

void InitGame(){

   // Initalize everything necessary
   allegro_init();       // initalize allegro game library
   install_keyboard();   // initalize keyboard
   set_color_depth(16);  // set color depth at 16-bit

   // set graphics mode to auto- detect card, screen 640 x 480
   set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);

   // make a buffer bitmap sized 640x480
   DBL_BUFFER = create_bitmap(640, 480);
   clear(DBL_BUFFER);

}

/* Main Function
************************************************************/

int main()
{

   InitGame();

   V3D *vout[4];

   set_projection_viewport(0, 0, SCREEN_W, SCREEN_H);

   vout[0]->x = -3;
   vout[0]->y =  3;
   vout[0]->z =  256;
   vout[0]->c =  makecol(255, 255, 0);

   vout[1]->x =  3;
   vout[1]->y =  3;
   vout[1]->z =  256;

   vout[2]->x =  3;
   vout[2]->y = -3;
   vout[2]->z =  256;

   vout[3]->x = -3;
   vout[3]->y = -3;
   vout[3]->z =  256;

   clear_to_color(DBL_BUFFER, makecol(0, 0, 255));
   polygon3d(DBL_BUFFER, POLYTYPE_FLAT, NULL, 4, vout);
   blit(DBL_BUFFER, screen, 0, 0, 0, 0, 640, 480);

   do{}while(!key[KEY_ESC]);

   destroy_bitmap(DBL_BUFFER);
   return 1;
}




- Raw text -


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