Can OpenGL draws in CMYK color mode?

Is there any way to let OpenGL draw in CMYK rather than RGBA color mode?

Is there any way to let OpenGL draw in CMYK rather than RGBA color mode?

Not directly, but you can use a fragment program to do the transformation.

You can store C in R, M in G, Y in B and K in A (still following? )

Anyway, the conversion code is simply:

RGB → CMYK
Black = minimum(1 - Red, 1 - Green, 1 - Blue)
Cyan = (1 - Red - Black) / (1 - Black)
Magenta = (1 - Green - Black)/ (1 - Black)
Yellow = (1 - Blue - Black) / (1 - Black)

CMYK → RGB
Red = 1 - minimum(1, Cyan * (1 - Black) + Black)
Green = 1 - minimum(1, Magenta * (1 - Black) + Black)
Blue = 1 - minimum(1, Yellow * (1 - Black) + Black)

Color components are all in the [0…1] range.

Edit: Fixed up UBB

[This message has been edited by al_bob (edited 08-19-2003).]

Thanks for the suggestion.

I guess I need to use glReadPixels() and glDrawPixels() to do the transformation. Do I need to tansform back to RGBA before displaying the image.

I had tried to copy an OpenGL 3D image into Adobe PhotoShop and change the color mode to CMYK, but the lighting effect was not smooth any more, this destroyed the 3D effects. Can this transformation method solve the problem. It seems to me that the same thing will happen. Have you use this method to create CMYK 3D images for printing. Is the 3D effects still kept.

Thanks again for your help.