[Openicc] Xorg low level buffers - colour conversion
Tomas Carnecky
tom at dbservice.com
Sat Mar 8 07:22:52 PST 2008
Gerhard Fuernkranz wrote:
> Tomas Carnecky wrote:
>> The fragment shader (which is what is of interest here) is executed
>> for every fragment (~pixel) separately. A simple (no-op) fragment
>> shader looks like this:
>>
>> void main()
>> {
>> gl_FragColor = gl_Color;
>> }
>
> ... where I guess that gl_FragColor and gl_Color are both 3-element
> vectors (R, G, B)?
>
> Is gl_Color fixed to be a 3-element vector, or can gl_Color also be a
> vector of different length (e.g. 4 for CMYK), which can then be
> converted by the shader to RGB (while the image is sent directly in e.g.
> CMYK color space to OpenGL)?
Both are a four component vector, how you interpret the components is up
to you, you could see it as CMYK for example. Usually it's RGBA.
> One more question, if one does not want to use the complete rendering
> pipeline, but if one wants to do only the color transformation on the
> GPU (i.e. send image data to GPU, do the transformation, and copy the
> data back), is it still possible to do this via OpenGL and
> GPU-independent shader programs? Or is proprietary GPU programming
> necessary then?
NVidia released CUDA, a C-like programing language for access to the GPU
(without requiring OpenGL or X11). However to do what you want you can
just as well use OpenGL directly. In X11 you can create off-screen
buffers and operate on those, instead of on visible windows. Apart from
the windowing system dependent parts (X11/windows/mac specific OpenGL
setup) there is nothing 'proprietary' involved.
Don't see OpenGL and the GPUs as a 'image rendering' API/chip. It's much
more versatile nowadays. Don't look at textures as images but 'array of
values', don't look at the GPU as a image rendering chip but as a
'floating point processor'.
Also take a look at http://www.gpgpu.org/ - General-Purpose Computation
Using Graphics Hardware.
tom
More information about the openicc
mailing list