From: "M Bailey" Newsgroups: comp.os.msdos.djgpp Subject: Re: Ultra-newbie needs ultra-help Date: Fri, 5 Feb 1999 18:55:56 -0000 Lines: 121 Message-ID: <79fes4$ghs$1@newnews.global.net.uk> References: <19990204071933 DOT 10404 DOT qmail AT hotmail DOT com> <36B9E7D5 DOT 855F0B98 AT cableol DOT co DOT uk> NNTP-Posting-Host: 195.147.129.124 X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I might be wrong, but I thought the Allegro documentation states that you need to set the color depth before setting the screen mode and that the default mode is already 8-bit ? Allens wrote in message <36B9E7D5 DOT 855F0B98 AT cableol DOT co DOT uk>... >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