Choosing your background color from a palette

Started by
3 comments, last by Hades11 20 years ago
Well i''ve spent the past couple of hours hunting trying to find out how I can change the background of an openGL window via a selection of colors. I know in many programs both 2d and 3d there is a standard palette that you can choose a color from (like in paint for example). What I want to do is have the user be able to change the background color from such a palette. If anyone could point me in the right direction that would be much appreicated. Thanks, Hades
--Ah but you very well mean you can't take less, it's very easy to take more than nothing.'
Advertisement
Programs like photoshop show red green and blue between 0-255, you can use glColor4i, ir divide those by 256.0 to get the float value.
I think you''ll have to write your own pal. Setup a some quads with the 3 basic colors in the right spots & let gl do the blending for you... & then you''ll have to implement mouse picking to tell where at in that area they clicked... & then do your color math (probably need a few if statements, you''ll see once you start fiddling with it) to generate the right color. That is of course only ONE way to do it, I''m sure there are more ideas out there.
Thanks for the ideas. I thought there was some standard way but since i''m using mfc (the program is a map editor) I was able to just make a dialog with bars for the RGB and that seemed to work well =)

--
Ah but you very well mean you can''t take less, it''s very easy to take more than nothing.''
--Ah but you very well mean you can't take less, it's very easy to take more than nothing.'
why don't you just use the standard colour picker built into windows..

CHOOSECOLOR cc;
memset(cc, 0, sizeof(CHOOSECOLOR));
cc.lStructSize = sizeof(CHOOSECOLOR);
cc.hwndOwner = hwnd;
cc.hInstance = NULL;
cc.rgbResult = backgroundColour;
cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc))
{
backgroundColour= cc.rgbResult;
}


Future Pinball

[edited by - Jumpman on March 21, 2004 11:14:57 PM]

This topic is closed to new replies.

Advertisement