#### Archived

This topic is now archived and is closed to further replies.

# Yellow in OGL...

This topic is 6091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, Can anyone tell me why I can't get yellow when I call glColor3f(0.0f, 1.0f, 1.0f) ? I get blue-green.... Edited by - Terran Marine on October 18, 2001 2:08:13 AM

##### Share on other sites
er... have you tried (1,1,0) ?

I think that was yellow last time i checked

its to do with the RGB colour model... have a look at a "colour cube" and it kinda makes sense... or something... now i'm confused... mmmm, too much coding for me the last few days

Edited by - Bad Monkey on October 18, 2001 2:19:58 AM

##### Share on other sites
Woops, you''re right about that color code, but it still doesn''t work.

##### Share on other sites
What doesn''t work about it? It looks fine to me.

##### Share on other sites
I think you need to do a little more research into how the computer actually displays graphics... ;-)

Basically, your CRT or LSD monitor is comprised of coloured phosphors, it''s the same in a TV - go up real close to the TV and have a look, there are red, green and blue phosphors. When these phosphors are hit by something in the monitor (I''m not afraid to admit it, I don''t know -exactly- how it works :-)) these phosphors light up.

In OpenGL you define colours using either 3 or 4 colour components. Red, green, blue and alpha. For now we will forget the alpha channel :-)

glColor3f(1.0f, 0.0f, 0.0f); Will describe a red colour, in other words, only the red phosphors are lit up. glColor3f(0.0f, 1.0f, 0.0f); Will describe a green colour and glColor3f(0.0f, 0.0f, 1.0f); Will describe a (you guessed it) blue colour.

Now you might well imagine that the 3 main colour components -should- be red, yellow and blue - just like you were taught in art at school. However, in reality, have you ever tried to make a bright green colour by mixing these primary colours? I dont know about you but I always came out with this dark greeny-brown colour, which to be frank didn''t look particularly green! But at the same time, in reality you can''t mix a true white colour by combining all 3 primary colours in equal amounts. This is because the paints work in such a way that they actually filter out all the other colours in the spectrum, giving you a really murky browny yellowy bluey greeny colour ;-) Now with a monitor we are not filtering out colours, we are projecting them.

Ok I''m not the definitive word on this, go look it up - but it must work the way I said because look! You can see white and yellow on your screen! It must be working!!!

Basically, what I''m saying is, to make yellow you combine red and green: glColor3f(1.0f, 1.0f, 0.0f); To make magenta you combine red and blue: glColor3f(1.0f, 0.0f, 1.0f); To make orange you have mostly red and a little green. Have a play around in a program such as paint shop pro - you''ll get the gyst of things ;-)

With regards to your problem though, if what everyone else suggested isn''t working, then you''ve got a different problem altogether and what you really need to do is to post some code ;-)

Hope that helps somewhat!

##### Share on other sites
Thanks for the help. I just found out my monitor is badly damaged, and the colors tend to get screwy.

##### Share on other sites
if you have a subwoofer (a big box that makes all sounds and music go BOOM BOOM BOOM - i.e. boosts the bass) and you have it too close to your monitor, it makes the colours go screwy.

of course, if you dont have a sub, then you''ve broken your monitor

MENTAL

##### Share on other sites
TheGilb you said:
"When these phosphors are hit by something in the monitor (I''m not afraid to admit it, I don''t know -exactly- how it works :-)) these phosphors light up."

Electron gun ring a bell? Electrons hit the rgb phosphors. Everything else you said is right on. Interesting to note is that the electrons are guided using electromagnets. Which is why putting a big magnet like a subwoofer near there messes up the colors. The elctrons don''t end up where intended. On some sensitive monitors you can even mess up the colors by turning it, as it will be differently oriented in relation to the earth''s magnetic field. These monitors when turned on or degaussed calibrate themselves with the earths magnetic field.

Ok to stay more on topic, the colors being screwy on your monitor could possibly be something as simple as replacing the monitor cable, or making sure its fully seated and all the pins are in place (not bent etc.)

Some monitors have easily replaceable cables, others have to be taken apart, only do this if you really know what you''re doing because there are some high voltages in there!

##### Share on other sites
quote:
Original post by element2001
TheGilb you said:
"When these phosphors are hit by something in the monitor (I''m not afraid to admit it, I don''t know -exactly- how it works :-)) these phosphors light up."

Electron gun ring a bell? Electrons hit the rgb phosphors. Everything else you said is right on. Interesting to note is that the electrons are guided using electromagnets.

Incidentally, that''s why trinitron monitors are so good. They have extra electromagnets to ''even out'' the magnetic field inside the picture tube, which results in a sharper image. If you''re working on a trinitron, you can see the shadow of the extra wire magnets on your screen, as a pair faint lines horizontally across your view.

quote:

Which is why putting a big magnet like a subwoofer near there messes up the colors. The elctrons don''t end up where intended.

Also why waving kitchen magnets in front of your TV is so much fun.

quote:

Ok to stay more on topic, the colors being screwy on your monitor could possibly be something as simple as replacing the monitor cable, or making sure its fully seated and all the pins are in place (not bent etc.)

Possibly. Could also be a video card that''s starting to go. Or a monitor that hasn''t been degaussed - Try either degaussing it or leaving it off for a couple days if you don''t have a degauss button.

My monitor did this once, but it turned out to be unrepairable. It wouldn''t display the red component of any colors. (Which made playing wind commander hell, since the text was all in red.)

quote:

Some monitors have easily replaceable cables, others have to be taken apart, only do this if you really know what you''re doing because there are some high voltages in there!

Actually, I''d say never dismantle your monitor unless you''re certified to do it. Not only will it void any warranty you might have, but capacitors that haven''t discharged could seriously injure you. If you screw things back in even slightly the wrong way (the FCC-mandated shielding is a major offender here) You can also completely fry your monitor.

##### Share on other sites
Once again, thanks for all the help.

II know all about degaussing and interference, that''s not the problem. My monitor is physically damaged. When I start my computer, the monitor won''t go on. I have to turn off both my monitor and my computer, and put them both on at the exact same time, otherwise my monitor won''t start up.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631434
• Total Posts
3000048
×