www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/04/13:37:20

Message-Id: <36B9E7D5.855F0B98@cableol.co.uk>
Date: Thu, 04 Feb 1999 18:32:53 +0000
From: Allens <allen DOT asjp AT cableol DOT co DOT uk>
X-Mailer: Mozilla 4.04 [en] (Win95; I)
Mime-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Ultra-newbie needs ultra-help
References: <19990204071933 DOT 10404 DOT qmail AT hotmail DOT com>
Reply-To: djgpp AT delorie DOT com

The only problem I can think of is that allegro does not support your
graphics card.  What card is it?

		Peter Allen


Stephen Gordon wrote:
> 
> I am trying to learn how to program in DJGPP. I have only just started.
> I have a
> P200 with Win95, and have downloaded DJGPP v2.8.1 and Allegro v3.1 (as
> well
> as RHIDE). My problem is that my program, which is supposed to display
> the
> Mandelbrot set on screen in 256 colors, only does it in 16. The source
> is below as
> it's fairly short, and the strange thing is that it works properly on my
> other more
> powerful computer which also runs Win95.
> Any suggestions? (I can't find this in the FAQs)
> 
> Stephen Gordon
> 
>  PS. I don't know any assembler.
> 
> Source code below
> ________________________________________________________________
> 
> #include "allegro.h"
> 
> int main()
> {
>    PALLETE pallete;
>    BITMAP *m_map;
>    RGB temp;
>    int x, y, c;
>    float a, b, aa, bb, m, n;
> 
>    allegro_init();
>    install_keyboard();
>    set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0);
>    set_color_depth(8);
> 
>    m_map = create_bitmap(800,600);
> 
>    /* first set the pallete to black to hide what we are doing */
>    for (c=0; c<255; c++){
>        pallete[c].r=0;
>        pallete[c].g=0;
>        pallete[c].b=0;
>        }
> 
>    pallete[1].r=255;
>    pallete[1].g=255;
>    pallete[1].b=255;
>    set_pallete(pallete);
> 
>    /* draw the M-set onto the memory-map */
>    for (y=0; y<600; y++){
>        for (x=0; x<800; x++){
>            a=b=c=aa=bb=0;
>            m=(2*(x-399.5)/399.5)-.5;
>            n=(2*(y-299.5)/299.5);
>            while (((a*a+b*b)<4)&&(c<256)){
>                  aa=a*a-b*b+m;
>                  bb=2*a*b+n;
>                  a=aa;
>                  b=bb;
>                  c++;
>            }
>            putpixel (m_map, x, y, c);
>            if (y==(int)(0.75*x))
>                  putpixel (screen, x, y, 1);
>        }
>    }
> 
>    blit(m_map, screen, 0, 0, 0, 0, 800, 600);
> 
>    /* fill our pallete with a gradually altering sequence of colors */
>    for (c=0; c<64; c++) {
>       pallete[c].r = c;
>       pallete[c].g = 0;
>       pallete[c].b = 0;
>    }
>    for (c=64; c<128; c++) {
>       pallete[c].r = 127-c;
>       pallete[c].g = c-64;
>       pallete[c].b = 0;
>    }
>    for (c=128; c<192; c++) {
>       pallete[c].r = 0;
>       pallete[c].g = 191-c;
>       pallete[c].b = c-128;
>    }
>    for (c=192; c<256; c++) {
>       pallete[c].r = 0;
>       pallete[c].g = 0;
>       pallete[c].b = 255-c;
>    }
>    /* animate the image by rotating the pallete */
>    while (!keypressed()) {
>       temp = pallete[255];
>       for (c=255; c>0; c--)
>   pallete[c] = pallete[c-1];
>       pallete[0] = temp;
>       set_pallete(pallete);
>    }
> 
>    return 0;
> }
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com

- Raw text -


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