Re: IDLgrWindow->Draw,/CREATE_INSTANCE [message #18120 is a reply to message #18032] |
Sun, 28 November 1999 00:00   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Marc Schellens (m_schellens@hotmail.com) writes:
> They don't work means:
> When I draw some background with ->Draw,/CREATE_INSTANCE, nothing is
> drawn
> while ->Draw,/DRAW_INSTANCE behaves like no keyword is set (so it just
> clears the screen and draws)
> I added a little test program, which should draw a picture
> and overdraws this picture shiftet a little bit to the upper right
> corner.
> For this program I figured out that it did not work on windows NT also.
> Please try, if this works on your machine.
Well, it doesn't work on my machine either, but this
is not because IDL capabilities are lacking. Rather,
I think it is because you are just a bit unclear
about how this works. The example in the IDL
documentation is not too bad as far as pseudo-code
goes, although if you perform the rotations in the
way they suggest you get some truly interesting--
if unintentional--effects. :-)
There are several things wrong with your example
code. But since I'm doing this for *my* purposes
as well as yours, I decided to create my own example
program, rather than fix yours.
I modified a Simple_Surface program I have to illustrate
object instancing. There is a new Rotation menu item that
gives you the opportunity to rotate the surface about the
X, Y, or Z axis. The Simple_Surface_Rotate event handler
contains the details. You can find the program, named
Rotate_Surface, here:
ftp://ftp.dfanning.com/pub/dfanning/outgoing/misc/rotate_sur face.pro
Compile the program and run it like this:
IDL> .Compile rotate_surface
IDL> Simple_Surface
You will notice that I have two models in the program, one
holds the objects that do not change in the rotation and one
holds the objects that do. The real key to performing this
kind of instancing is to hide the appropriate model at the
proper time and to be sure you see everything (by making
the view transparent) when you are performing the operations.
It's a bit tricky, but the code in the event handler
illustrates how straightforward it is once you have the
concepts clearly in mind.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|