Jump to content

Displaying intermediate results


Recommended Posts

Is there any way for a plugin to complete part of the rendering process, display the results, then continue rendering? For example, a plugin which renders into an axillary surface might complete a number of rendering phases, and as each phase is completed, move the results from the aux. surface into the dst surface. For plugins that take a long time to complete, that might be interesting and useful.

Link to comment
Share on other sites

Too bad. It seems pretty simple to implement. Just cause a re-render as if a control changed and have the render routine structured as a state machine. That presupposes the actual rendering is done in OnSetRenderInfo and Render just copies the result into dst.

Edited by MJW
Link to comment
Share on other sites

Too bad. It seems pretty simple to implement. 


Don't make the mistake of assuming you know how this could be done.  You probably don't have an inkling of how the pdn system is structured.  A programmer like Rick will generally find it quite offensive if you say things like this.

Link to comment
Share on other sites

For your amusement, and perhaps edification, here's a version of Red ochre's Scribble plugin that shows intermediate rendering steps.


This is just a demonstration, NOT a released plugin. It has absolutely no guarantees! It hasn't been tested on a multicore system -- or tested much at all, actually.


Many thanks to Red ochre for allowing me to (mis)appropriate his code.


The plugin: ScribbleIntermediate.zip


The VS project: ScribbleIntermediate.zip

Link to comment
Share on other sites

Thanks, Red ochre!


There's a comment in ScribbleConfigDialog.cs that explains the basic idea:

        // Cause a retraversal to continue rendering by calling FinishTokenUpdate
        // This is quite complicated, but I don't know how to do it a simpler way.
        // I want to call FinishTokenUpdate on the thread that created the controls.
        // To do so, I create a fake label control (with a null label) along with the
        // other controls. I toggle the visibility using the asynchronous BeginInvoke method.
        // That method somehow -- I wish I knew the details -- runs in the control-creating
        // thread, which is necessary since controls can only be accessed from that thread.
        // Changing the visibility causes the VisibleChanged event handler for that control
        // to run, which calls FinishTokenUpdate. When FinishTokenUpdate is called for other
        // reasons, I set the restartTraversal flag. That's to avoid remaining permanently
        // out of sync should one of the attempts to cause a retraversal fail to cause one.
Edited by MJW
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...