#### Archived

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

# Yellow in OGL...

## 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.

##### Share on other sites
element2001 : An electron gun!!! *lol* My memory is so bad sometimes! When I was writing that message earlier today I was sitting there trying to recall all the information I could , but all I could think of was ''cathode rays'' (Duh!) when I was describing how the phosphors are lit up - Too early in the day, that''s what I put it down to ;-) Or maybe I was all thunked out from college *g* (Though I didn''t know about the electromagnets guiding the electrons)

But what''s ironic is that after all that... After making a fool of myself and blathering on about unimportant information I don''t really know all that much about, it was just the fact that his monitor was bust!!!

##### Share on other sites
I don''t think you made a fool of yourself TheGilb. I would have given him the same advice at first not knowing the monitor was at fault. You''d think it would be easy to tell the monitor is the problem because everything else it displays would be off color too!

It just seemed like you needed a reminder and I hate when things are on the tip of my tongue and I can''t remember the details so I didn''t want you to go on trying to figure it out or have to look it up so I felt I just had to remind you.

Incidentally cathode stands for negative and electrons are negatively charged which is why it''s called a cathode ray tube.

##### Share on other sites
Is this some sort of joke?

##### Share on other sites
I had a monitor go bad from the refresh rate being set improperly.

##### Share on other sites
quote:
Original post by TheGilb
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.

What exactly do you mean by an LSD (heh) monitor and where can i get one if it means what i interpret it as????????

##### Share on other sites
hah I noticed that to and forgot to comment, LSD monitor lol. I think that basically that means if you do enough LSD you don''t need a monitor, just hallucinate the images in your head lol.

Either that or he meant LCD? nah i''ll go with the former it sounds more umm interesting.

Gee i wonder what the framerate is and how many polygons you can render in an LSD hallucination? hehe

##### Share on other sites
Just to clarify the purpose of the electron gun to you folks. To put it simpley, in the back of the monitor is a "gun" that shoots out electrons at a variable rate depending on the code in the machine. To direct this beam with precision across the screen a few hundred times every 1/65 of a second, the monitor uses basically two magentic bars, one on the x one on thr y. By increasing voltage on anypoint along the bars the electron beam can be beant. This bending points the electrons toward the groups of three phosphours (known as a triad). The phousphors are excited and you get some color on your screen (i''m sure you know all this, just clarification). Because the electron beam is best if not turned off and on between each triad, some monitors use a shadow mask. This is a sheet across the back of the screen with holes that line up with triads. This way the electrons hit the mask and don''t do any harm.

Anyway this is the little bit that i know.

RELIGION IS THE ROOT OF ALL EVIL

##### Share on other sites
The other interesting thing is why you''re taught that red, blue and yellow are the primary colors in elementary but red, green and blue in televisions and other projective devices. The answer? Light.

Light is an electromagnetic wave (it''s also corpuscular, but that''s a whole ''nother thread...) meaning it has a wavelength and frequency and all that good radio-type stuff. The colors we see from looking at things are what they reflect from the original light source (usually the sun). Wood, for example, absorbs all frequencies except for those shades of brown, orange-ish and yellow-ish that we recognize as particular types of wood. If you send two EM signals (waves) along an identical path, they interfere. If the amplitudes of the waves are equal in magnitude and opposite in sign at certain points, the waves cancel at those points. That''s how blue and green light produce yellow (the waves cancel each other partially, and what''s left is the yellow wavelength.)

That''s also why (and how) blue and yellow paint give green. Pigments absord certain colors (subtractive synthesis), unlike light which is additive. That''s why it seems backwards.

##### Share on other sites
Good answer, Oluseyi. Was about to post a similar one, and was relieved that you did it for me....

email

the way that things have come to be.
Desensitized to everything.
What became of subtlety?
--Tool

P.S. I also think that an LSD monitor would be... err... kinda nice.

Edited by - Lord Karnus on October 21, 2001 5:47:02 AM

##### Share on other sites
quote:

Oluseyi wrote:
If the amplitudes of the waves are equal in magnitude and opposite in sign at certain points, the waves cancel at those points. That''s how blue and green light produce yellow (the waves cancel each other partially, and what''s left is the yellow wavelength.)

This is wrong. Electromagnetic waves cancel each other out (or create interference) only if they are phaseshifted (or have another frequency, as you said) *and* are polarized on the same plane. This is true for eg. laser light. But it''s not true for ''normal'' light (sunlight, lightbulb, or the light your screen produces). Normal light *never* creates interference, only polarized light does.

The reason why the red/green/blue thing works is follows:
The color-sensitive part of the human retina is composed of 3 types of light-sensitive cells (plus intensity cells, but that''s not for color). Each type of cell is sensitive only for a certain range of the light spectrum, but they *overlap*. This is the key: Take monochromatic green light, and only *one* cell type will be activated, you''ll see pure green. Same for red and blue. But if you have yellow light, with a wavelength between green and yellow, then 2 types of cells will be activated *at the same time*, those for green and red. Your brain will create the color ''yellow'' from it.

A monitor just uses this property of the human eye: to produce yellow, it activates green and red light (that do *not* interfere !), both wavelengths reach the eye, and the ''green wave'' activates the green cell, the ''red wave'' activates the red cell. The brain is fooled and *thinks* it is yellow (because both cell types are active, see above), and ''displays'' yellow into your mind...

- AH

• ### Forum Statistics

• Total Topics
628354
• Total Posts
2982230

• 10
• 9
• 11
• 24
• 11