delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/16/06:43:14

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE353FA0B@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Allegro
Date: Tue, 16 Feb 1999 11:36:52 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

Eric Berenson writes:
> How does one set a graphics mode besides 320x200 with Allegro?

Call set_gfx_mode(GFX_AUTODETECT, w, h, 0, 0). No magic is required.

> With VBEAF installed on a fine system and graphics board, why 
> doesn't this work?

Which VBE/AF driver? What graphics card?

>  allegro_init();
>  set_color_depth(8);
>  set_gfx_mode_("VBEAF", 800, 600, 0, 0 );

Passing "VBEAF" as a string is totally wrong: this should be one
of the driver ID codes that are defined in allegro.h, eg. 
GFX_AUTODETECT or GFX_VBEAF. You will almost always want to use
the autodetect mode, but I'm a bit puzzled as to why this would
be causing you problems, because any unknown ID will cause
Allegro to autodetect, so passing a random pointer should have
the same effect as GFX_AUTODETECT. My guess is that you were
just unlucky, and the compiler happened to put this string in
a location that has the same address as the ID constant for
some other driver that isn't suitable for your system. That 
seems incredibly unlikely, but it's the only explanation I can
think of right now...

Also, you _must_ check the return code from set_gfx_mode(), to
make sure that it really worked! It is incredible how many
people don't bother to do this, and then run into problems
because the mode set fails, their program crashes as soon as
they try to call a graphics function, and they don't know why.

> My computer crashes horribly every time I do anything besides 
> 320x200. The testing programs that came with allegro work fine. 
> I peeled code out of them unitl I thought I figured out how to 
> get the hi res modes. 

Where did you get that "VBEAF" bit from, then? Just copy the init
code from any of the SVGA example programs, eg. ex23.c.


	Shawn Hargreaves.

- Raw text -


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