Re: svgalib tutorial

Search this archive.

From: Jay Link (jlink@ilbbs.com)
Date: Fri 27 Oct 2000 - 16:55:32 IST


> Everytime you want to change the color c, you first do a c++, then you change 
> it with gl_setpalettecolor. why can't this be done without the 'c++'?
> 
> I tried this, and it didn't work without it. I really had to change the value 
> of c... what actually happens when i do c++?

When you tried it, was the entire screen one color? (I'm pressed for time
here, so I can't experiment, but I wrote that code sample, so I'll help
the best I can  :-)  ).

When you set your graphics mode, you select 'x' number of colors. For
example, one mode might allow for 256 colors, and another for 16 million.
I believe that gradient example used a 256-color mode, which means that
you get 256 seperate colors to play around with. Now, instead of just
accepting the default colors, the program customizes a number of them with
gl_setpalettecolor(). This gives the various shades of blue.

It's only to save a loop that the palette is customized as the lines are
drawn. The complete palette could be set first, and then the lines drawn.

Note that if you set a palette color, draw with it, and then change that
palette color, then your previously-drawn shapes using that color will
change to match the new palette. I suspect this is what happened with your
gradient program.

> And another thing about the color issue, I've tried playing around with this 
> for quite a long time now, and I've noticed that the more variables I create, 
> the less colors I can use.... for example, there was a moment that when I 
> added just one more integer, my red color (wich was c_red, set with 
> gl_setpalettecolor(c_red,63,0,0);) would just dissapear!

Can you show us the code on this one? At the moment, all I can think is
that you've exceeded the number of colors that your chosen screen mode
will allow, but I can't say for sure without seeing anything.


-JL


------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST