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

Home » Public Forums » archive » How to Get Started with the Z-Buffer
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
How to Get Started with the Z-Buffer [message #51959] Tue, 19 December 2006 08:30
Ryan. is currently offline  Ryan.
Messages: 77
Registered: March 2006
Member
Dear All,

I have a routine that plots about 15 plots and saves it to a postscript
file. I want to automate this routine and put it into the cron but
because I can't use graphics windows there I'm trying to modify my code
to use the Z-buffer. I've read that all you have to do is set the
Z-buffer (using SET_PLOT, 'Z') and plot normally. After plotting all
my graphs, I read the image (a = TVRD()), set the PS device (SET_PLOT,
'PS'), and display the image (TV, a), but all I get is a large black
box in the output. Is there anything I am missing? The IDL help on
the Z-buffer is not very insightful on what it could be.

My code is too long to include here but I have put relevant sections
(at least I think they are relevant) to show what I'm doing. I'm not
sure the resolution of a typical letter-sized page, so I have just
guessed values it to be 10000x7500.

Also, i included an intermediate step of switching to the X device and
plotting then switching back to the Z device , but all I get is a black
window. Does the Z buffer use different color defaults than X? Like
say, the background color?

Here are the relevant sections of my routine:

myDevice=!D.NAME
IF DEBUG THEN PRINT, 'Setting Z device'
set_plot, 'Z'
DEVICE, SET_RESOLUTION=[10000, 7500], Z_BUFFER=0

;Setting the background to White and Plotting color to black
tvlct, 255, 255, 255, !p.background
tvlct, 0, 0, 0, !p.color

;Storing the current configuration to be restored later
thisMulti = !P.MULTI
!P.MULTI = [0, 1, n_plots, 0, 0]

;ploting (call plot command up to 15 times)
;...
;after the first plot I issue the following command to
;see if i can display it on the screen
IF DEBUG THEN BEGIN
aa = TVRD()
SET_PLOT,'X', /COPY
TV, aa
SET_PLOT, 'Z', /COPY
TV, aa
ENDIF
;

;Restore the previous configuration
!P.MULTI = thisMulti

xyouts, 12000, 19500, title_string, alignment=0.5, /device
xyouts, 15000, 0, 'Created: '+systime(), alignment=0.5, /device

;Read the image
IF DEBUG THEN PRINT, 'Reading Image'
a = TVRD()

;Setting up the postscript file
DEVICE, Z_BUFFER=1
IF DEBUG THEN PRINT, 'Setting Postscript Device'
SET_PLOT, 'PS'
plotfilename = 'plots.ps'

;Configuring the Postscript device
device, FILENAME=plotfilename, XSIZE=9.25, YSIZE=7, /INCHES, $
/HELVETICA
pageInfo = PSWindow(PAGESIZE=paper, XFUDGE=xfudge, $
YFUDGE=yfudge, /LANDSCAPE)
device, _Extra=pageInfo

;Sending the image to the ps file
IF DEBUG THEN PRINT, 'Sending Image to Postscript file'
TV, a

;Closing the file and device so that it gets outputted
device, /close_file
device, /close
set_plot, myDevice


Thank you in advance,
Ryan.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: 64-bit without IDL_IDLBridge vs. 32-bit with IDL_IDLBridge
Next Topic: How to Get Started with the Z-Buffer

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

Current Time: Wed Oct 08 19:24:44 PDT 2025

Total time taken to generate the page: 0.00538 seconds