Re: Question about using palettes with images and shader in object graphics [message #83272] |
Tue, 12 February 2013 12:13 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
M. Katz writes:
>
> Here I'll answer my own question definitively from the IDL Help on IDLgrImage (See the last line):
>
> PALETTE
> An object reference to a palette object (an instance of the IDLgrPalette object class) that specifies the red, green, and blue values of the color lookup table to be associated with the image if it is an indexed color image. This property is ignored if the image is a greyscale or RGB image.
>
> Note: This table is only used when the destination is an RGB model device. The Indexed color model writes the indices directly to the device. In order to ensure that these colors are used when the image is displayed, this palette must be copied to the graphics destination’s palette for any graphics destination that uses the Indexed color model.
>
> Note: If a SHADER is associated with the image object, the palette is ignored.
This seems to conflict with this statement, in the same documentation:
Note: If a PALETTE has been set, the palette lookup is done before the
fragment shader is executed. Therefore, when the fragment shader reads
from the image texture it will be passed 8-bit per channel RGB data
(read from the palette), not the original 1-channel image data.
Go figure. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: Question about using palettes with images and shader in object graphics [message #83273 is a reply to message #83272] |
Tue, 12 February 2013 12:05  |
M. Katz
Messages: 69 Registered: May 2005
|
Member |
|
|
Here I'll answer my own question definitively from the IDL Help on IDLgrImage (See the last line):
PALETTE
An object reference to a palette object (an instance of the IDLgrPalette object class) that specifies the red, green, and blue values of the color lookup table to be associated with the image if it is an indexed color image. This property is ignored if the image is a greyscale or RGB image.
Note: This table is only used when the destination is an RGB model device. The Indexed color model writes the indices directly to the device. In order to ensure that these colors are used when the image is displayed, this palette must be copied to the graphics destination’s palette for any graphics destination that uses the Indexed color model.
Note: If a SHADER is associated with the image object, the palette is ignored.
|
|
|
Re: Question about using palettes with images and shader in object graphics [message #83277 is a reply to message #83273] |
Tue, 12 February 2013 10:32  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
M. Katz writes:
> When displaying an IDLgrImage with an associated IDLgrShader, is the IDLgrPalette functionality disabled?
>
> Without the shader, you can use oImage.SetProperty, PALETTE=oPalette to change the display's color scheme in an instant.
>
> But with IDLgrShader, I'm fearing that it's a much more difficult task that will require writing code in shader language, which I've never attempted before.
>
> Any thoughts?
Never done it, but just reading the documentation, I would expect you to
also have to replace the shader object after changing the palette, to
get the shader to use the palette.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|