comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Colors in 8-bit Z buffer
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Colors in 8-bit Z buffer [message #89946] Wed, 07 January 2015 10:02 Go to previous message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
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...

Below is an example.


=============
How It Should Look
=============

;Create window and positions
window, /Free, XSize=400, YSize=600
pos = cgLayout([1,3])

;Create data
data1 = cgDemoData(1)
data2 = cgDemoData(13)
data3 = cgDemoData(21)

;Draw plots and images
cgPlot, data1, AXISCOLOR='Grey', POSITION=pos[*,0], TITLE='Time Series', XTITLE='Time (s)', YTITLE='Data', COLOR='Purple'
cgImage, data2, /NOERASE, /AXES, AXKEY={AXISCOLOR: 'Purple'}, POSITION=pos[*,1], TITLE='Hurricane Gilbert', XTITLE='Lat', YTITLE='Lon', CTINDEX=15
cgImage, data3, /NOERASE, /AXES, AXKEY={AXISCOLOR: 'Blue'}, POSITION=pos[*,2], TITLE='Red Blood Cells', XTITLE='Height (um)', YTITLE='Length (um)', CTINDEX=3


===========
Z Buffer Example
===========

;Set up the Z Buffer
xsize = 400
ysize = 600
thisDevice = !D.Name
Set_Plot, 'Z'
Device, Get_Pixel_Depth=thisDepth
Device, Set_Pixel_Depth=8, Set_Resolution=[xsize, ysize], Z_Buffer=0
cgErase, 'White'

;Create data
data1 = cgDemoData(1)
data2 = cgDemoData(13)
data3 = cgDemoData(21)

;Create window and positions
window, /Free, XSize=xsize, YSize=ysize
pos = cgLayout([1,3])

;Draw plots and images
cgPlot, data1, AXISCOLOR='Grey', POSITION=pos[*,0], TITLE='Time Series', XTITLE='Time (s)', YTITLE='Data', COLOR='Purple'
cgImage, data2, /NOERASE, /AXES, AXKEY={AXISCOLOR: 'Purple'}, POSITION=pos[*,1], TITLE='Hurricane Gilbert', XTITLE='Lat', YTITLE='Lon', CTINDEX=15
cgImage, data3, /NOERASE, /AXES, AXKEY={AXISCOLOR: 'Blue'}, POSITION=pos[*,2], TITLE='Red Blood Cells', XTITLE='Height (um)', YTITLE='Length (um)', CTINDEX=3

;Save the buffer
img = cgSnapShot()
wDelete, !D.Window

;Reset the device
Device, Set_Pixel_Depth=thisDepth, Z_Buffer=1
Set_Plot, thisDevice

;Display the contents of the buffer
window, /Free, XSize=xsize, YSize=ysize
cgImage, img
[Message index]
 
Read Message
Read Message
Previous Topic: differential equation solving when changing the coefficients with time
Next Topic: IDL and Mac Retina Displays

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:33:59 PDT 2025

Total time taken to generate the page: 0.00401 seconds