From ddfc526d0c5747cea055f277695f753658dc122c Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 17 Oct 2012 11:05:51 +0200 Subject: [PATCH] Changed: #573 Add anti-aliasing to the OpenGL Driver --- .../3d/driver/opengl/driver_opengl_states.cpp | 21 +++++++++++++++++++ .../3d/driver/opengl/driver_opengl_states.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index fa4e626a8..1d517d0fc 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -94,6 +94,7 @@ void CDriverGLStates::forceDefaults(uint nbStages) _CurLighting= false; _CurZWrite= true; _CurStencilTest=false; + _CurMultisample= false; // setup GLStates. glDisable(GL_FOG); @@ -102,6 +103,7 @@ void CDriverGLStates::forceDefaults(uint nbStages) glDisable(GL_ALPHA_TEST); glDisable(GL_LIGHTING); glDepthMask(GL_TRUE); + glDisable(GL_MULTISAMPLE_ARB); // Func. _CurBlendSrc= GL_SRC_ALPHA; @@ -379,6 +381,25 @@ void CDriverGLStates::enableStencilTest(bool enable) } } +// *************************************************************************** +void CDriverGLStates::enableMultisample(bool enable) +{ + H_AUTO_OGL(CDriverGLStates_enableMultisample); + + // If different from current setup, update. +#ifndef NL3D_GLSTATE_DISABLE_CACHE + if( enable != _CurMultisample ) +#endif + { + // new state. + _CurMultisample= enable; + // Setup GLState. + if(_CurMultisample) + glEnable(GL_MULTISAMPLE_ARB); + else + glDisable(GL_MULTISAMPLE_ARB); + } +} // *************************************************************************** void CDriverGLStates::blendFunc(GLenum src, GLenum dst) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.h b/code/nel/src/3d/driver/opengl/driver_opengl_states.h index fda404e03..be5c1918f 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.h @@ -44,6 +44,7 @@ namespace NLDRIVERGL { - GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_R - GL_COLOR_MATERIAL - GL_FOG + - GL_MULTISAMPLE_ARB - glActiveTextureARB() - glClientActiveTextureARB() - glEnableClientState() glDisableClientState() with: @@ -99,6 +100,9 @@ public: /// enable/disable stencil test void enableStencilTest(bool enable); bool isStencilTestEnabled() const { return _CurStencilTest; } + /// enable/disable multisample + void enableMultisample(bool enable); + bool isMultisampleEnabled() const { return _CurMultisample; } // @} /// glBlendFunc. @@ -197,6 +201,7 @@ private: bool _CurLighting; bool _CurZWrite; bool _CurStencilTest; + bool _CurMultisample; GLenum _CurBlendSrc; GLenum _CurBlendDst;