+ avoid unncessary calls of setSampleBuffer

This commit is contained in:
wmayer 2014-05-12 18:53:21 +02:00
parent 2b28d41134
commit 066fbfda0a

View File

@ -2326,12 +2326,12 @@ void View3DInventorViewer::turnDeltaDimensionsOff()
void View3DInventorViewer::setAntiAliasingMode(View3DInventorViewer::AntiAliasing mode) void View3DInventorViewer::setAntiAliasingMode(View3DInventorViewer::AntiAliasing mode)
{ {
getGLRenderAction()->setSmoothing(false); int buffers = 1;
int buffers = 0; SbBool smoothing = false;
switch( mode ) { switch( mode ) {
case Smoothing: case Smoothing:
getGLRenderAction()->setSmoothing(true); smoothing = true;
break; break;
case MSAA2x: case MSAA2x:
buffers = 2; buffers = 2;
@ -2347,10 +2347,13 @@ void View3DInventorViewer::setAntiAliasingMode(View3DInventorViewer::AntiAliasin
break; break;
}; };
if (getGLRenderAction()->isSmoothing() != smoothing)
getGLRenderAction()->setSmoothing(smoothing);
#if SOQT_MAJOR_VERSION > 1 || (SOQT_MAJOR_VERSION == 1 && SOQT_MINOR_VERSION >= 5) #if SOQT_MAJOR_VERSION > 1 || (SOQT_MAJOR_VERSION == 1 && SOQT_MINOR_VERSION >= 5)
if (getSampleBuffers() != buffers)
setSampleBuffers(buffers); setSampleBuffers(buffers);
#else #else
if(buffers != 0) if (buffers > 1)
Base::Console().Warning("Multisampling is not supported by SoQT < 1.5, this anti-aliasing mode is disabled"); Base::Console().Warning("Multisampling is not supported by SoQT < 1.5, this anti-aliasing mode is disabled");
#endif #endif
} }
@ -2363,7 +2366,7 @@ View3DInventorViewer::AntiAliasing View3DInventorViewer::getAntiAliasingMode() c
#if SOQT_MAJOR_VERSION > 1 || (SOQT_MAJOR_VERSION == 1 && SOQT_MINOR_VERSION >= 5) #if SOQT_MAJOR_VERSION > 1 || (SOQT_MAJOR_VERSION == 1 && SOQT_MINOR_VERSION >= 5)
int buffers = getSampleBuffers(); int buffers = getSampleBuffers();
switch(buffers) { switch(buffers) {
case 0: case 1:
return None; return None;
case 2: case 2:
return MSAA2x; return MSAA2x;
@ -2372,7 +2375,7 @@ View3DInventorViewer::AntiAliasing View3DInventorViewer::getAntiAliasingMode() c
case 8: case 8:
return MSAA8x; return MSAA8x;
default: default:
const_cast<View3DInventorViewer*>(this)->setSampleBuffers(0); const_cast<View3DInventorViewer*>(this)->setSampleBuffers(1);
return None; return None;
}; };
#else #else