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

Home » Public Forums » archive » Re: 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
Re: How to Get Started with the Z-Buffer [message #51943] Wed, 20 December 2006 07:01
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ryan. writes:

> I've looked over my code and found that I had a call to Widget_control
> (WIDGET_CONTROL, /RESET) and a LOADCT command that I had hidden in
> there that wanted access to X windows. These commands were in there
> for the graphical display which I have now changed. So it works great
> now, writing straight to postscript.

Hurray! Score one for simplicity! :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: How to Get Started with the Z-Buffer [message #51945 is a reply to message #51943] Wed, 20 December 2006 06:55 Go to previous message
Ryan. is currently offline  Ryan.
Messages: 77
Registered: March 2006
Member
> Is there some kind of DEVICE command somewhere you aren't
> telling us about?

I've looked over my code and found that I had a call to Widget_control
(WIDGET_CONTROL, /RESET) and a LOADCT command that I had hidden in
there that wanted access to X windows. These commands were in there
for the graphical display which I have now changed. So it works great
now, writing straight to postscript.

Thank you all for your help,

Ryan.
Re: How to Get Started with the Z-Buffer [message #51949 is a reply to message #51945] Wed, 20 December 2006 00:41 Go to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
> I can't run it in the cron because IDL needs
> access to X Windows.

That's right, at least I had the same problem when running IDL from a
cron job on a Linux Server without a running X-Server. However, the
fact that IDL requires X Windows for starting does not imply that it
requires you to actually _use_ it ... There is nothing wrong with
having X Windows at hand but just fully ignoring it and directly
printing to Postscript.

Cheers,

Peter
Re: How to Get Started with the Z-Buffer [message #51951 is a reply to message #51949] Tue, 19 December 2006 13:18 Go to previous message
Kenneth Bowman is currently offline  Kenneth Bowman
Messages: 86
Registered: November 2006
Member
In article <1166557284.886392.124780@n67g2000cwd.googlegroups.com>,
rchughes@gmail.com wrote:

> Before I started to incorporate the Z buffer I was writing it straight
> to the postscript device like you suggested (it is much easier I must
> say) but for some reason I can't run it in the cron because IDL needs
> access to X Windows. I don't know why. I thought IDL might need Xwin
> to plot so after reading several posts on this newsgroup it pointed me
> towards using the Z buffer. So I've tried to have all the plots write
> to the Z buffer before sending it to either Xwin or Postscript but
> current attempts have been unsuccessful.

If you really do need an X display, then this page will give some
tips on how to do that from a cron job

http://idl.tamu.edu/mactips/headless_X.php

The page is aimed at Mac OS X users, but it should work for most
current versions of X Windows on other OSes.

Ken Bowman
Re: How to Get Started with the Z-Buffer [message #51954 is a reply to message #51951] Tue, 19 December 2006 11:55 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rchughes@gmail.com writes:

> The reason I am using the Z buffer is because the routine that I took
> it from either displays the plots in an X window on the screen or
> creates a postscript file. Creating the postscript file is just an
> option that I have included in the routine.
>
> Before I started to incorporate the Z buffer I was writing it straight
> to the postscript device like you suggested (it is much easier I must
> say) but for some reason I can't run it in the cron because IDL needs
> access to X Windows. I don't know why.

I think this is the place to start your investigations.
Is there some kind of DEVICE command somewhere you aren't
telling us about? Are you trying to find out what fonts
are available? How many colors are available? Have you
tried setting your device to "NULL" and seeing what happens?

> I thought IDL might need Xwin
> to plot so after reading several posts on this newsgroup it pointed me
> towards using the Z buffer. So I've tried to have all the plots write
> to the Z buffer before sending it to either Xwin or Postscript but
> current attempts have been unsuccessful.

It's not unusually to get bum advice when reading
this newsgroup. I'd set my filters so the only articles
you see are those by JD Smith. :-)

> Would you stll suggest to send it straight to postscript?

Yes, there is nothing about writing to PostScript that will
confuse your cron job. You will have to look for the problem
elsewhere.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: How to Get Started with the Z-Buffer [message #51955 is a reply to message #51954] Tue, 19 December 2006 11:41 Go to previous message
rchughes is currently offline  rchughes
Messages: 26
Registered: April 2006
Junior Member
> For starters, why are you fooling around with the Z-buffer
> at all? Just write the darn thing into a PostScript file
> to begin with.

The reason I am using the Z buffer is because the routine that I took
it from either displays the plots in an X window on the screen or
creates a postscript file. Creating the postscript file is just an
option that I have included in the routine.

Before I started to incorporate the Z buffer I was writing it straight
to the postscript device like you suggested (it is much easier I must
say) but for some reason I can't run it in the cron because IDL needs
access to X Windows. I don't know why. I thought IDL might need Xwin
to plot so after reading several posts on this newsgroup it pointed me
towards using the Z buffer. So I've tried to have all the plots write
to the Z buffer before sending it to either Xwin or Postscript but
current attempts have been unsuccessful.

Would you stll suggest to send it straight to postscript?

Thanks,
Ryan.
Re: How to Get Started with the Z-Buffer [message #51956 is a reply to message #51955] Tue, 19 December 2006 10:31 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ryan. writes:

> 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.

Well, it strikes me that just about everything about
this approach is wrong. But I don't want to discourage
you any. :-)

For starters, why are you fooling around with the Z-buffer
at all? Just write the darn thing into a PostScript file
to begin with. You can certainly do this with a cron job
and by doing this you have the ENORMOUS advantage of being
able to use PostScript resolution and not some rinky-dink
buffer or screen resolution. Your journal editor will smile
with you.

I think the basic reason you are seeing a big black window
is that either you are (1) drawing black on black (a result
of changing color indices 0 and 255, which is almost always
a BAD idea if you are going to try to create a PostScript
file, or (2) seeing only a portion of your "image" because
of a huge mismatch between the aspect ratio of your Z-buffer
and PostScript window. I can't tell which is the case, but
I don't have much motivation to find out, since both problems
would be eliminated by the simpler PostScript approach, which
I HIGHLY recommend.

I would do something like this:

keywords = PSConfig(Cancel=cancelled, XSize=10.25, YSize=8, $
/Inches, XOffset=0.25, YOffset=10.75, /Color, Bits=8, $
Filename='myfile.ps', /NoGUI, /Landscape)
thisDevice = !D.Name
Set_Plot, 'PS'
Device, _Extra=keywords
!P.Multi = [0,1,nsteps]
FOR j=0, nsteps-1 DO
Plot, data, ....
ENDFOR
Device, /Close_File
Set_Plot, thisDevice
!P.Multi = 0

There are a number of articles on my web page explaining the
various finer points of PostScript output, but I think the simpler
you can make it the better.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Anyone used FastDL?
Next Topic: Sorting with IDL... Please give me any suggestions!!!

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

Current Time: Wed Oct 08 15:27:25 PDT 2025

Total time taken to generate the page: 0.00503 seconds