From c90f51afbe79b2a1003122dfd50dabf3d93f35ca Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 5 Aug 2013 03:53:18 +0200 Subject: [PATCH] Look for OpenGL 3.3 not 1.2 on startup. --HG-- branch : gsoc2013-dfighter --- .../3d/driver/OpenGL3/driver_opengl_extension.cpp | 13 +++++++++---- .../src/3d/driver/OpenGL3/driver_opengl_extension.h | 10 +++------- .../src/3d/driver/OpenGL3/driver_opengl_texture.cpp | 7 ++----- .../driver/OpenGL3/driver_opengl_vertex_program.cpp | 4 ---- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_extension.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl_extension.cpp index beffa6f33..11afe7949 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_extension.cpp @@ -895,13 +895,18 @@ static bool setupPackedDepthStencil(const char *glext) void registerGlExtensions(CGlExtensions &ext) { H_AUTO_OGL(registerGlExtensions); - // OpenGL 1.2 ?? + const char *nglVersion= (const char *)glGetString (GL_VERSION); sint a=0, b=0; - // 1.2*** ??? - sscanf(nglVersion, "%d.%d", &a, &b); - ext.Version1_2= (a==1 && b>=2) || (a>=2); + sscanf(nglVersion, "%d.%d", &a, &b); + if( ( a < 3 ) || ( ( a == 3 ) && ( b < 3 ) ) ) + { + nlinfo( "OpenGL version is less than 3.3!" ); + nlinfo( "Version string: %s",nglVersion ); + nlassert( false ); + } + // Extensions. const char *glext= (const char*)glGetString(GL_EXTENSIONS); GLint ntext; diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_extension.h b/code/nel/src/3d/driver/OpenGL3/driver_opengl_extension.h index 158d2d3f9..2e2d618d7 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_extension.h @@ -33,8 +33,7 @@ namespace NLDRIVERGL3 { /// The extensions used by NL3D. struct CGlExtensions { - // Is this driver a correct OpenGL 1.2 driver? - bool Version1_2; + std::string GLVersion; // Required Extensions. bool ARBMultiTexture; @@ -83,7 +82,6 @@ struct CGlExtensions // ARB Extensions bool ARBTextureCompression; bool ARBFragmentProgram; - bool ARBVertexProgram; bool ARBTextureNonPowerOfTwo; bool ARBMultisample; @@ -98,7 +96,6 @@ public: CGlExtensions() { // Fill all false by default. - Version1_2= false; ARBMultiTexture= false; NbTextureStages= 1; EXTTextureEnvCombine= false; @@ -122,7 +119,6 @@ public: ATIEnvMapBumpMap = false; ATIFragmentShader = false; ARBFragmentProgram = false; - ARBVertexProgram = false; NVTextureRectangle = false; EXTTextureRectangle = false; EXTTextureFilterAnisotropic = false; @@ -144,7 +140,7 @@ public: std::string toString() { std::string result = "OpenGL version "; - result += Version1_2 ? "1.2 or above(*)" : "1.1 or below"; + result += GLVersion; result += "; Available extensions:"; result += "\n Texturing: "; @@ -169,7 +165,7 @@ public: result += NVTextureShader ? "NVTextureShader " : ""; result += ATIFragmentShader ? "ATIFragmentShader " : ""; result += ARBFragmentProgram ? "ARBFragmentProgram " : ""; - result += ARBVertexProgram ? "ARBVertexProgram " : ""; + result += "ARBVertexProgram"; result += "\n Misc: "; result += EXTVertexWeighting ? "EXTVertexWeighting " : ""; diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_texture.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl_texture.cpp index 398f3ece4..f33b6d576 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_texture.cpp @@ -518,11 +518,8 @@ static inline GLenum translateWrapToGl(ITexture::TWrapMode mode, const CGlExtens H_AUTO_OGL(translateWrapToGl) if(mode== ITexture::Repeat) return GL_REPEAT; - - if(extensions.Version1_2) - return GL_CLAMP_TO_EDGE; - - return GL_CLAMP; + + return GL_CLAMP_TO_EDGE; } // *************************************************************************** diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_program.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_program.cpp index fd691034a..cd7d225f4 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_program.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_vertex_program.cpp @@ -41,11 +41,7 @@ CVertexProgamDrvInfosGL3::CVertexProgamDrvInfosGL3 (CDriverGL3 *drv, ItVtxPrgDrv { H_AUTO_OGL(CVertexProgamDrvInfosGL_CVertexProgamDrvInfosGL); - // Extension must exist - nlassert ( drv->_Extensions.ARBVertexProgram ); - nglGenProgramsARB(1, &ID); - } //=================================================================================================