CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2009
    Posts
    399

    Multiple drawing solution

    Hi all. I want to ask you something: to share your experience and share me a solution to next issue: I had an SDI app, with CView based on CScrollView, where I render a bitmap, simple bitmap. Also, I had an CDialog, where I want to render the same bitmap like on CView, but on the second monitor (in fact it is a multimonitor arhitecture). But is really necesary that the drawing from CView an CDialog is being performed syncron, I mean in the same time.

    For this, I want to implement an UIThread solution for CDialog, take it from here:
    http://www.codeguru.com/cpp/misc/mis...onstration.htm

    does not function properly, and some programmers suggerate to avoid UIThreads ...

    Now, the issue remain: what solution whould use to render the same bitmap, on the two views, in the same time ? (On CView and CDialog on second monitor).

    Kindly thank you.

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: Multiple drawing solution

    Quote Originally Posted by mesajflaviu View Post
    But is really necesary that the drawing from CView an CDialog is being performed syncron, I mean in the same time.
    Strictly speaking, I don't think that is possible. But the more important question is: why?
    What's wrong with just bit-blitting the bitmap in the WM_PAINT handler?
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #3
    Join Date
    Jan 2009
    Posts
    399

    Re: Multiple drawing solution

    The sistem is a blackbox monitor, which can compose an 3D image from 2 monitors and a mirror, so, if the rendering of CView::OnDraw methos is taking too long, and CDialog::OnPaint comes next, the user see the delay on compounded 3D image, and looks ugly ...

  4. #4
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: Multiple drawing solution

    Quote Originally Posted by mesajflaviu View Post
    The sistem is a blackbox monitor, which can compose an 3D image from 2 monitors and a mirror, so, if the rendering of CView::OnDraw methos is taking too long, and CDialog::OnPaint comes next, the user see the delay on compounded 3D image, and looks ugly ...
    I don't know of any method faster than BitBlt when you draw onto a window DC. If that's not fast enough, maybe you can try using DirectX or OpenGL to draw the image.
    Did you measure (or observe) that the drawing is too slow? If so, can you post your painting code (with timings)?
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  5. #5
    Join Date
    Jan 2009
    Posts
    399

    Re: Multiple drawing solution

    I drawing with classic double-buffering code, nothing special, and timming is pretty good, on 1440X900 monitor, I had measure arround 14 - 16 ms ... but I would like to draw syncron on two of monitor though ...

  6. #6
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Multiple drawing solution

    Only way you can do that reliably enough is going DirectX full screen and get a canvas for the 2 monitors.
    Prepare both image parts assuming the same frame count.

    Nomatter what you do, doing things via the desktop will incur a number of delays and other annoyances that will cause desynchronisation (GDI blits/conversions, the desktop manager, desktop composer, WM_PAINT's being inherently asynchronous, messaging delays if there are lots of hooks, background apps taking CPU time, ...).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured