comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Persistent Object Graphics Not Persistent in Resizeable Windows

Re: Persistent Object Graphics Not Persistent in Resizeable Windows
type: item
description: [A copy of this article was sent to the cited author.] Phil Williams writes: > There is a suggestion in one of the manuals that retain=2 should not be > used for draw widgets that are objects (grpahics_level=2). Instead use > /expose_events keyword and then have something like this > > if event.id eq info.drawID then begin > if event.type eq 4 then info.thisWindow->draw, info.thisView > endif > > in the event handler to draw the window when it's exposed. > > I added this to your sample code and the axes appear fine when the > widget is resized. Thanks to Phil Williams and RSI for pointing out my problems with this code. In fact, setting the Retain flag for object windows is NOT a good idea. Removing it got my code working fine. Here is what I heard from RSI about this issue: > As far as 'retain' goes. If you have are using a widget application > I would recommend that you always set your retain to 0 then process > the EXPOSE event in your event handler by calling the draw method > on your window object. > > This is mainly a performance/memory issue. Using retain of 0 allows > OpenGL to double buffer the window and drawings occur much faster. > Since you have the window retained already (the view/scene object) > you can make the determination of when to reissue a draw command. > With retain=2, OpenGL has a buffer of the graphic, IDL has a buffer > of the graphic (so it can repair the bits), and you have a 'buffer' > to the graphic (the object). Under IDL 4.x this wasn't the case, > so retain of 2 was the best choice (and still is for level 1 > graphics). Good information to have. I'll update the data base and add a tip to my web page. Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting Customizable IDL Programming Courses Phone: 970-221-0438 E-Mail: davidf@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com IDL 5 Reports: http://www.dfanning.com/documents/anomaly5.html
creator: davidf
date: 1997-06-06T07:00:00-00:00

Re: Persistent Object Graphics Not Persistent in Resizeable Windows
type: item
description: David, There is a suggestion in one of the manuals that retain=2 should not be used for draw widgets that are objects (grpahics_level=2). Instead use /expose_events keyword and then have something like this if event.id eq info.drawID then begin if event.type eq 4 then info.thisWindow->draw, info.thisView endif in the event handler to draw the window when it's exposed. I added this to your sample code and the axes appear fine when the widget is resized. Here's the edited code: ;----------------------------------------------------------- ------- Pro XSurface_Cleanup, tlb ; Come here when program dies. Free all created objects. Widget_Control, tlb, Get_UValue=info Obj_Destroy, info.thisContainer END ;----------------------------------------------------------- -------- PRO Draw_Event, event ; Event handler to handle draw events. Widget_Control, event.top, Get_UValue=info, /No_Copy ; The window was exposed so redraw it! if event.type eq 4 then info.thisWindow->draw, info.thisView Widget_Control, event.top, Set_UValue=info, /No_Copy end ;----------------------------------------------------------- ------- PRO XSurface_Resize, event ; The only events generated by this simple program are resize ; events, which are handled here. ; Get the info structure. Widget_Control, event.top, Get_UValue=info, /No_Copy ; Resize the draw widget. ;88888888888888888888888888888888888888888888888888888888888 888 ; Here is the problem. Comment this line out and uncomment the ; two below it to see that the problem comes from resizing the ; window. info.thisWindow->SetProperty, Dimension=[event.x, event.y] ;info.thisWindow->erase, Color=[0,0,0] ;Wait, 1 ;88888888888888888888888888888888888888888888888888888888888 888 ; Redisplay the graphic. info.thisWindow->Draw, info.thisView ;Put the info structure back. Widget_Control, event.top, Set_UValue=info, /No_Copy END ;----------------------------------------------------------- -------- PRO XSurface, data ; Need some data. Catch, error IF error NE 0 …
creator: Phil Williams
date: 1997-06-06T07:00:00-00:00

Re: Persistent Object Graphics Not Persistent in Resizeable Windows
type: item
description: Stein Vidar writes: > David Fanning wrote: >> >> I've run into a problem in which I lose all my axes labeling >> if I resize my draw widget object window before evoking the >> Draw method of the window. Here is a bug report and some >> sample code to see the problem. (Those of you who want to >> see how to add axes to a surface plot, take note. :-)) > > This posting has kept me scratching my head for quite a > while. > > I've tested the program that was attatched, on a machine > with !version = { alpha OSF unix 5.0 Apr 28 1997} > and my problem is that I can't figure out what the problem > is/was... I can't see any difference between the plot before > and after resizing... What *was* the problem - did the > axes disappear, did the axes *values* disappear, or what.. What happened on my machine is that the axis labelling disappeared, although not the axes themselves, when the window was resized. > In toying around with it I even managed to get IDL into > a state where it didn't process any resizing events at > all, though I can't reproduce that state... calling > xmanager didn't do anything (though since this is a non- > blocking widget I guess it shouldn't..) Hope this doesn't > happen often...might have been me doing something strange.. I've noticed this myself, but like you, I can't reproduce it. I've even had random crashes just from closing object windows, but I can't reproduce that in a reliable way either. It seems to have gone away now that I know a little more what I am doing. :-) > Also, I can't help but feeling that the redraw is quite > slow compared to "direct" graphics... Is this something > other people notice as well? I think in general object redraw will be slower than direct graphic redraw. This is due to the fact that objects must be rendered or sent through the graphics system each time. I have not noticed in the simple things I have done so far that speed is much of an issue. > And what on earth does the retain state have to do with > whether or n…
creator: davidf
date: 1997-06-11T07:00:00-00:00

Re: Persistent Object Graphics Not Persistent in Resizeable Windows
type: item
description: David Fanning wrote: > > Folks, > > I've run into a problem in which I lose all my axes labeling > if I resize my draw widget object window before evoking the > Draw method of the window. Here is a bug report and some > sample code to see the problem. (Those of you who want to > see how to add axes to a surface plot, take note. :-)) > This posting has kept me scratching my head for quite a while. I've tested the program that was attatched, on a machine with !version = { alpha OSF unix 5.0 Apr 28 1997} and my problem is that I can't figure out what the problem is/was... I can't see any difference between the plot before and after resizing... What *was* the problem - did the axes disappear, did the axes *values* disappear, or what.. In toying around with it I even managed to get IDL into a state where it didn't process any resizing events at all, though I can't reproduce that state... calling xmanager didn't do anything (though since this is a non- blocking widget I guess it shouldn't..) Hope this doesn't happen often...might have been me doing something strange.. Also, I can't help but feeling that the redraw is quite slow compared to "direct" graphics... Is this something other people notice as well? And what on earth does the retain state have to do with whether or not axes are appearing correctly or not..? Utterly confused... Stein Vidar
creator: Stein Vidar Hagfors H
date: 1997-06-11T07:00:00-00:00