CWnd::OnDraw should be CView::OnDraw(); if it's a CWnd then it's
CWnd::OnPaint()

2009/4/20 Can T. Oguz <[email protected]>

> I think it's better not to call frame() within BeginPaint() / EndPaint()
> block. That's the main difference of CWnd::OnDraw(). We don't care about the
> invalidated region of Windows, so you can call frame() later, and do not
> forget to disable background erasing which also has no use in an OSG window.
>
>
> 2009/4/20 Jesper D. Thomsen <[email protected]>
>
>>  Hi, and thank you for answering.
>>
>> I'm currently doing that by calling frame() within my OnDraw() handler,
>> but I'm suspecting (without any proof) that it gets called too often
>> somehow, and that there's some queuing within OSG that I'm not using
>> properly. When calling a pure OpenGL rendering pipeline from OnDraw() (the
>> old viewport renderer which OSG is replacing) I do not have the problem.
>>
>>
>> Jesper D. Thomsen
>>
>> **
>>
>>  ------------------------------
>> *From:* [email protected] [
>> [email protected]] On Behalf Of Can T. Oguz [
>> [email protected]]
>> *Sent:* Monday, April 20, 2009 12:41 PM
>> *To:* OpenSceneGraph Users
>> *Subject:* Re: [osg-users] OpenScenegraph MFC application freezes in
>> Vista when cpu is maxed out.
>>
>>   Hi,
>>
>> You may want to try posting frame requests as windows messages (via
>> PostMessage()). Call frame() within the handler.
>>
>> Regards,
>>
>> Can
>>
>>
>> 2009/4/20 Jesper D. Thomsen <[email protected]>
>>
>>>  Hi all, I have a somewhat irritating error in Vista (and to a lesser
>>> degree Windows XP).
>>>
>>> I'm using OSG 2.6.1 to render a viewport in an MFC application (built in
>>> Visual Studio 2005 SP1). I'm running in single-threaded mode (although I
>>> have tried multithreaded also without any luck). I'm manually calling frame
>>> when I want the viewport to be updated rather than using run(), as I don't
>>> want to waste cpu/gpu on redrawing a stationary viewport. My problem is that
>>> when I have a somewhat complex model loaded, the cpu-load on the single core
>>> sometimes spikes out at maximum load when doing updates fast (such as during
>>> a fast drag). When this happens the machine often freezes the OSG viewport
>>> (and the cpu load continues at maximum for a single core). In Vista I have
>>> to terminate the application, but in Windows XP I can change focus to
>>> another application window and the viewport returns to normal (0% cpu load)
>>> when I switch back to my application.
>>>
>>> I'm all out of ideas as to exactly why this happens, as I don't
>>> completely understand if I'm allowed to call frame() rapidly or not. I'm
>>> looking for a function which can tell me if the previous frame() has
>>> completed, in order to not call a new frame() before the previous is done. I
>>> don't believe this should be necessary, but I have obviously done something
>>> to offend OSG :)
>>>  Any ideas or insights will be much appreciated.
>>>
>>> regards, and thanks in advance.
>>>
>>>
>>> Jesper D. Thomsen
>>>
>>> **
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> [email protected]
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to