Changeset 10147

Show
Ignore:
Timestamp:
05/07/09 15:15:19 (5 years ago)
Author:
robert
Message:

From Chris Denham, "For me, on Windows, I also get a slew of these warnings when I move the window off screen.
So, might be a bit fiddly to try and prevent frame update in all situations that SwapBuffers? retuns false.
I wondered if we could address this issue by only reporting the error if GetLastError? is also non zero. Works for me!
The value returned by GetLastError? is zero when SwapBuffers? is called for a minimized or off screen window, so we could just add a check for this.
Just say the word, and I'll post my modified GraphicsWindowWin?32.cpp to the submissions list. ;-)
Cheers.
Chris.

e.g.

//------------- OSG- 2..8 ----------
void GraphicsWindowWin?32::swapBuffersImplementation()
{

if (!_realized) return;
if (!::SwapBuffers?(_hdc))

{

reportErrorForScreen("GraphicsWindowWin?32::swapBuffersImplementation() - Unable to swap display buffers", _traits->screenNum, ::GetLastError?());

}

}
//------------- Modification to remove redundant warnings ----------
void GraphicsWindowWin?32::swapBuffersImplementation()
{

if (!_realized) return;
if (!::SwapBuffers?(_hdc) && ::GetLastError?() != 0)

{

reportErrorForScreen("GraphicsWindowWin?32::swapBuffersImplementation() - Unable to swap display buffers", _traits->screenNum, ::GetLastError?());

}

}
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowWin32.cpp

    r10068 r10147  
    17881788{ 
    17891789    if (!_realized) return; 
    1790     if (!::SwapBuffers(_hdc)) 
     1790    if (!::SwapBuffers(_hdc) && ::GetLastError() != 0) 
    17911791    { 
    17921792        reportErrorForScreen("GraphicsWindowWin32::swapBuffersImplementation() - Unable to swap display buffers", _traits->screenNum, ::GetLastError());