Re: Colors in 8-bit Z buffer [message #89947 is a reply to message #89946] |
Wed, 07 January 2015 12:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Matthew Argall writes:
> I am wondering there are any tricks to managing the color table in an 8-bit Z buffer. I read "Graphics without Graphics Windows" on the coyote website as well as comments in cgSetColorState. Both indicate why there are problems.
>
> Say I want to create several graphics, each with independent color choices. The last graphic seems to determine how all others will appear. An example is below. I can set the pixel depth to 24 and things work fine. The Pixel depth is 8-bits by default, though, which was making things not working out the way I wanted. Made me curious...
The reason this works on your display is that the Coyote Graphics
commands *always* work in a 24-bit color space if they can. The "if they
can" part was also true for the Z-graphics buffer in the early days of
Coyote Graphics. But, the Coyote Graphics system was way ahead of its
time, and the author didn't realize there were still hundreds of
programmers writing programs the same way they wrote them in the 1970s,
so he had to give up his quixotic dreams of "one ring to control them
all."
The problem (explained more fully in the comments in cgSetColorState) is
that although it is not a problem to put the Z-buffer into a 24-bit
state, it is a lot more difficult to set it back to an 8-bit state.
Basically, because of the way the Z-buffer works, setting the state back
to 8-bit means you erase whatever is in the Z-buffer. This is
problematic, because to do anything useful you have to take a picture of
the buffer before you erase it, etc. A chicken and egg thing...
If this is what you care about, though, just set the Z-buffer up as a
24-bit device and leave it there. The Coyote Graphics routines will work
perfectly. :-)
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.")
|
|
|