So who knows OpenGL programming stuff?

Fonzie
10-20-2009, 03:21 PM
I guarantee this is a simple questions but I've been working my ass for midterms and **** and my brain is retarded.

How could I adapt the RGB color model in OpenGL to allow me to work with a subtractive color model?

If I used like glColor3f(1.0, 0.0, 0.0) for RGB would it be like 1 - Red, 1 - Green, 1 - Blue?

But to get the complement of red, I'd need something more like glColor3f(0.5, 0.0, 0.5) to get magenta I think.

Is there any easy conversion or something?

Blah, help!

coombz
10-20-2009, 03:24 PM
Ayyyyyyyyy!!

Lineage
10-20-2009, 03:24 PM
I have no idea what you're asking for; do you want to know the exact color codes needed to achieve certain colors?

I think there might be tools/charts out there for RGB conversion, but honestly you can just experiment.

Big Monkey
10-20-2009, 03:25 PM
Is this for T1 with better graphics project?

Ciceron
10-20-2009, 03:28 PM
I guarantee this is a simple questions but I've been working my ass for midterms and **** and my brain is retarded.

How could I adapt the RGB color model in OpenGL to allow me to work with a subtractive color model?

If I used like glColor3f(1.0, 0.0, 0.0) for RGB would it be like 1 - Red, 1 - Green, 1 - Blue?

But to get the complement of red, I'd need something more like glColor3f(0.5, 0.0, 0.5) to get magenta I think.

Is there any easy conversion or something?

Blah, help!

Magenta is 1, 0, 1.

def
10-20-2009, 03:29 PM
i always struggled with this when setting my quake 3 crosshair color in the console

Fonzie
10-20-2009, 03:34 PM
Magenta is 1, 0, 1.

Yeah, you're right. I don't know why I don't classify purple as magenta, I always think it's lighter.

Fonzie
10-20-2009, 03:34 PM
I have no idea what you're asking for; do you want to know the exact color codes needed to achieve certain colors?

I think there might be tools/charts out there for RGB conversion, but honestly you can just experiment.

I really don't know. It's just a question on my study sheet that says "Describe how you would adapt the RGB color model in OpenGL to allow you to work with a subtractive color model."

Edit: My friend said the Prof probably isn't looking to actually work with the code and to just talk in generalities. Doing this would probably be much easier than messing with the code, since I know the theory behind the subtractive color model.

PropIsDead
10-20-2009, 03:40 PM
happy knows opengl/glide programming, i think

:psyduck:

Lineage
10-20-2009, 03:45 PM
Uhh, ok. I suppose you could just default all of your RGB values to 1,1,1 and then use your own subtractive model. Otherwise you could override the default glColor3f to invert the color input system such that glColor3f(.1,0,0) gives you less red, instead of more and set default color to white.

*edit

Alternatively, you can create your own CYMK color class that acts as a layer of abstraction between subtractive color values and RGB. You'll have to implement CYMK->RGB conversions yourself, and there will probably be color loss.

Fonzie
10-20-2009, 03:51 PM
That would probably work. I don't know why I didn't really think of that, it makes sense since 1.0, 1.0, 1.0 = white and that's the default you start at for subtractive color models, rather than RGB which the default's black.

That was pretty freaking easy.

New major AMIRITE.

HaPpY
10-20-2009, 04:00 PM
isnt this just a color wheel question? and to get magenta you'd use a blue tone on red... but that isnt the compliment of red, rather green is

:shrug:

Lineage
10-20-2009, 04:01 PM
Meh, OpenGL is a lot to take in. Honestly there might be a better solution than the one I gave you, it's been a while since I worked with it. :shrug:

Fonzie
10-20-2009, 04:08 PM
isnt this just a color wheel question? and to get magenta you'd use a blue tone on red... but that isnt the compliment of red, rather green is

:shrug:

It is but I think it's more theoretically about how I'd have to adapt one of the RGB functions to make it subtractive. Since RGB default is a black surface say glColor3f(0.0, 0.0, 0.0), you add 1 to red to make it red: glColor3f(1.0, 0.0, 0.0). But for the subtractive color model you'd start with a white default: glColor3f(1.0, 1.0, 1.0) and to get red, subtract the green and blue channels: glColor3f((1.0 0), (1.0 1.0, (1.0 1.0)) to get glColor3f(1.0, 1.0, 1.0).

At least that's my guess.

:shrug:

Meh, OpenGL is a lot to take in. Honestly there might be a better solution than the one I gave you, it's been a while since I worked with it. :shrug:

Wasn't a great class to take for my last elective I guess.

But according to TW, being a Computer Science and Computer Security major is ****ty anyways so I guess the wider variety of classes I take, the better chance I have at getting a decent job.

:shrug:

Lineage
10-20-2009, 04:17 PM
It is but I think it's more theoretically about how I'd have to adapt one of the RGB functions to make it subtractive. Since RGB default is a black surface say glColor3f(0.0, 0.0, 0.0), you add 1 to red to make it red: glColor3f(1.0, 0.0, 0.0). But for the subtractive color model you'd start with a white default: glColor3f(1.0, 1.0, 1.0) and to get red, subtract the green and blue channels: glColor3f((1.0 0), (1.0 1.0, (1.0 1.0)) to get glColor3f(1.0, 1.0, 1.0).

At least that's my guess.

:shrug:



Wasn't a great class to take for my last elective I guess.

But according to TW, being a Computer Science and Computer Security major is ****ty anyways so I guess the wider variety of classes I take, the better chance I have at getting a decent job.

:shrug:
Computer Science is a great field in terms of employment spectrum. Everyone ****ing hires programmers or, at least, people with technical skills.

Subtractive color models just means that instead of default black it's default white, and you are "removing" colors from the display spectrum. CMYK is a subtractive model that's used for printing (cyan magenta yellow black). There are formulas for converting RGB to CMYK, but there is color loss.

Fonzie
10-20-2009, 04:21 PM
Computer Science is a great field in terms of employment spectrum. Everyone ****ing hires programmers or, at least, people with technical skills.

Subtractive color models just means that instead of default black it's default white, and you are "removing" colors from the display spectrum. CMYK is a subtractive model that's used for printing (cyan magenta yellow black). There are formulas for converting RGB to CMYK, but there is color loss.

Yeah, I was reading up on this a little prior to solving my problem and it only added more headaches by reading that there's not a very good conversion model and that there is always color loss.

I think the problem was I made this question out to be way more specific than it was intended. Thanks for all the help though, I appreciate it.

Lineage
10-20-2009, 04:21 PM
Yeah, I was reading up on this a little prior to solving my problem and it only added more headaches by reading that there's not a very good conversion model and that there is always color loss.

I think the problem was I made this question out to be way more specific than it was intended. Thanks for all the help though, I appreciate it.
*ahem*

Aaaayyyyy :bigthumb: