Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

PDL double-buffering

by bsb (Priest)
on Feb 22, 2007 at 02:08 UTC ( #601472=perlquestion: print w/ replies, xml ) Need Help??
bsb has asked for the wisdom of the Perl Monks concerning the following question:

I'm doing some visualization with PDL and get quite a bit of flicker. I suspect that double-buffering would solve the problem, is there a way to do this with PDL::Graphics::TriD? Or am I on the wrong track?

Brad

Comment on PDL double-buffering
Re: PDL double-buffering
by syphilis (Canon) on Feb 22, 2007 at 04:30 UTC
    If you don't get a satisfactory response here, consider posting the question to the perldl mailing list. There's at least one active list member there that uses TriD fairly heavily and may be able to help. Of course, there may be the same (or even better) assistance available right here.

    Cheers,
    Rob
      There's been quite a lot of PDL material recently so I think once I go to sleep the night-shift Perl Elves will wake up and prod me in the right direction.

      I didn't find anything in the PDL archives or code though...

Re: PDL double-buffering
by moklevat (Priest) on Feb 22, 2007 at 17:24 UTC
    Hi Brad,

    I have done some work with PDL::Graphics::TriD and the only time I have noticed flicker is when my X server was configured to use software OpenGL rendering instead of the videocard's hardware rendering. If you are visualizing a large dataset or updating it with some intensive computation I might expect some lag when loading the new model, but not flicker. For example, I can throw 1,000,000 points into a model and stretch the window to 1600x1200 and rotate the plot all over the place without flicker. Doing the same thing while moving the points around generates a lot of lag between iterations, but no visible flicker.

    If the hardware rendering isn't the problem, could you provide some more information about the type of visualization you are doing (large dataset, frequent updates, etc.)?

      Thanks for the suggestions

      Hardware gl seems to be fine, glxgears runs smoothly:
      $ glxinfo | grep -i direct direct rendering: Yes
      I'll follow up with more details soon, but I doubt volume of the data is the problem, it's quite modest by PDL standards, and when I'm using the "twiddle" mode to look-around an unchanging model there is no flicker. Previously I just had a mesh which seemed ok but when I used a filled sheet there is a noticeable flicker as the light sheet is draw over the dark background.

      I might not need double-buffering exactly, but a GL equivalent that only draws once all the things to draw are queued.
Re: PDL double-buffering
by bsb (Priest) on Feb 23, 2007 at 05:48 UTC
    I found out what is going on, PDL does double-buffer, at the line:
    # PDL/Graphics/TriD/GL.pm" line 789 sub display { # ... $this->{_GLObject}->glXSwapBuffers(); }
    display is called from twiddle which does the model fly-through stuff. My flicker came from using hold3d, points3d then imag3d_ns but points3d calls graph_object (calling twiddle_current then twiddle), so the points were drawn, the buffers swapped making imag3d_ns seem to flicker. I just need to avoid the points3d shortcut, and other forms using graph_object.

    Brad

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://601472]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-07-30 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (240 votes), past polls