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 b29efab25..0741fae9c 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_extension.cpp @@ -101,15 +101,6 @@ NEL_PFNGLMULTITEXCOORD4IVARBPROC nglMultiTexCoord4ivARB; NEL_PFNGLMULTITEXCOORD4FVARBPROC nglMultiTexCoord4fvARB; NEL_PFNGLMULTITEXCOORD4DVARBPROC nglMultiTexCoord4dvARB; -// ARB_TextureCompression. -NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC nglCompressedTexImage3DARB; -NEL_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC nglCompressedTexImage2DARB; -NEL_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC nglCompressedTexImage1DARB; -NEL_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC nglCompressedTexSubImage3DARB; -NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC nglCompressedTexSubImage2DARB; -NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC nglCompressedTexSubImage1DARB; -NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC nglGetCompressedTexImageARB; - // VertexWeighting. NEL_PFNGLVERTEXWEIGHTFEXTPROC nglVertexWeightfEXT; NEL_PFNGLVERTEXWEIGHTFVEXTPROC nglVertexWeightfvEXT; @@ -339,6 +330,14 @@ PFNGLBLITFRAMEBUFFERPROC nglBlitFramebuffer; PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC nglRenderbufferStorageMultisample; PFNGLFRAMEBUFFERTEXTURELAYERPROC nglFramebufferTextureLayer; +PFNGLCOMPRESSEDTEXIMAGE3DPROC nglCompressedTexImage3D; +PFNGLCOMPRESSEDTEXIMAGE2DPROC nglCompressedTexImage2D; +PFNGLCOMPRESSEDTEXIMAGE1DPROC nglCompressedTexImage1D; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC nglCompressedTexSubImage3D; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC nglCompressedTexSubImage2D; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC nglCompressedTexSubImage1D; +PFNGLGETCOMPRESSEDTEXIMAGEPROC nglGetCompressedTexImage; + // GL_ARB_separate_shader_objects PFNGLUSEPROGRAMSTAGESPROC nglUseProgramStages; PFNGLACTIVESHADERPROGRAMPROC nglActiveShaderProgram; @@ -514,24 +513,6 @@ static bool setupARBMultiTexture(const char *glext) return true; } -// ********************************* -static bool setupARBTextureCompression(const char *glext) -{ - H_AUTO_OGL(setupARBTextureCompression); - - CHECK_EXT("GL_ARB_texture_compression"); - - CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC, glCompressedTexImage3DARB); - CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC, glCompressedTexImage2DARB); - CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC, glCompressedTexImage1DARB); - CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC, glCompressedTexSubImage3DARB); - CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC, glCompressedTexSubImage2DARB); - CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC, glCompressedTexSubImage1DARB); - CHECK_ADDRESS(NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC, glGetCompressedTexImageARB); - - return true; -} - // ********************************* static bool setupARBTextureNonPowerOfTwo(const char *glext) { @@ -793,7 +774,15 @@ static bool setupGLCore(const char *glext) CHECK_ADDRESS(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer); CHECK_ADDRESS(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample); CHECK_ADDRESS(PFNGLFRAMEBUFFERTEXTURELAYERPROC, glFramebufferTextureLayer); - + + CHECK_ADDRESS(PFNGLCOMPRESSEDTEXIMAGE3DPROC, glCompressedTexImage3D); + CHECK_ADDRESS(PFNGLCOMPRESSEDTEXIMAGE2DPROC, glCompressedTexImage2D); + CHECK_ADDRESS(PFNGLCOMPRESSEDTEXIMAGE1DPROC, glCompressedTexImage1D); + CHECK_ADDRESS(PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedTexSubImage3D); + CHECK_ADDRESS(PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC, glCompressedTexSubImage2D); + CHECK_ADDRESS(PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC, glCompressedTexSubImage1D); + CHECK_ADDRESS(PFNGLGETCOMPRESSEDTEXIMAGEPROC, glGetCompressedTexImage); + return true; } @@ -917,9 +906,6 @@ void registerGlExtensions(CGlExtensions &ext) ext.NbTextureStages= (ntext<((GLint)IDRV_MAT_MAXTEXTURES)?ntext:IDRV_MAT_MAXTEXTURES); } - // Check ARBTextureCompression - ext.ARBTextureCompression= setupARBTextureCompression(glext); - // Check ARBTextureNonPowerOfTwo ext.ARBTextureNonPowerOfTwo= setupARBTextureNonPowerOfTwo(glext); @@ -927,7 +913,7 @@ void registerGlExtensions(CGlExtensions &ext) ext.ARBMultisample = setupARBMultisample(glext); // Compression S3TC OK iff ARBTextureCompression. - ext.EXTTextureCompressionS3TC= (ext.ARBTextureCompression && setupEXTTextureCompressionS3TC(glext)); + ext.EXTTextureCompressionS3TC= setupEXTTextureCompressionS3TC(glext); // Check if NVidia GL_EXT_vertex_weighting is available. ext.EXTVertexWeighting= setupEXTVertexWeighting(glext); 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 6942fe8b2..86ff3da26 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_extension.h @@ -35,26 +35,30 @@ struct CGlExtensions { std::string GLVersion; - // Required Extensions. + // Required extensions bool GLCore; bool ARBSeparateShaderObjects; + // Optional extensions + bool EXTTextureCompressionS3TC; + bool EXTTextureFilterAnisotropic; + float EXTTextureFilterAnisotropicMaximum; + + // Required Extensions. (old) bool ARBMultiTexture; uint NbTextureStages; - // Optional Extensions. - bool EXTTextureCompressionS3TC; + // Optional Extensions. (old) bool EXTVertexWeighting; bool EXTSeparateSpecularColor; bool ARBTextureCubeMap; bool NVTextureRectangle; bool EXTTextureRectangle; bool ARBTextureRectangle; - bool EXTTextureFilterAnisotropic; - float EXTTextureFilterAnisotropicMaximum; - bool EXTSecondaryColor; bool EXTBlendColor; + bool ARBTextureNonPowerOfTwo; + bool ARBMultisample; // WGL ARB extensions, true if supported bool WGLARBPBuffer; @@ -66,18 +70,12 @@ struct CGlExtensions bool GLXSGISwapControl; bool GLXMESASwapControl; - // ARB Extensions - bool ARBTextureCompression; - bool ARBTextureNonPowerOfTwo; - bool ARBMultisample; - public: CGlExtensions() { // Fill all false by default. ARBMultiTexture= false; NbTextureStages= 1; - ARBTextureCompression= false; EXTTextureCompressionS3TC= false; EXTVertexWeighting= false; EXTSeparateSpecularColor= false; @@ -107,7 +105,6 @@ public: result += "\n Texturing: "; result += ARBMultiTexture ? "ARBMultiTexture " : ""; - result += ARBTextureCompression ? "ARBTextureCompression " : ""; result += EXTTextureCompressionS3TC ? "EXTTextureCompressionS3TC " : ""; result += ARBTextureCubeMap ? "ARBTextureCubeMap " : ""; result += NVTextureRectangle ? "NVTextureRectangle " : ""; @@ -213,17 +210,6 @@ extern NEL_PFNGLMULTITEXCOORD4FVARBPROC nglMultiTexCoord4fvARB; extern NEL_PFNGLMULTITEXCOORD4DVARBPROC nglMultiTexCoord4dvARB; -// ARB_TextureCompression. -//======================== -extern NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC nglCompressedTexImage3DARB; -extern NEL_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC nglCompressedTexImage2DARB; -extern NEL_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC nglCompressedTexImage1DARB; -extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC nglCompressedTexSubImage3DARB; -extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC nglCompressedTexSubImage2DARB; -extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC nglCompressedTexSubImage1DARB; -extern NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC nglGetCompressedTexImageARB; - - // VertexWeighting. //================== extern NEL_PFNGLVERTEXWEIGHTFEXTPROC nglVertexWeightfEXT; @@ -463,6 +449,14 @@ extern PFNGLBLITFRAMEBUFFERPROC nglBlitFramebuffer; extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC nglRenderbufferStorageMultisample; extern PFNGLFRAMEBUFFERTEXTURELAYERPROC nglFramebufferTextureLayer; +extern PFNGLCOMPRESSEDTEXIMAGE3DPROC nglCompressedTexImage3D; +extern PFNGLCOMPRESSEDTEXIMAGE2DPROC nglCompressedTexImage2D; +extern PFNGLCOMPRESSEDTEXIMAGE1DPROC nglCompressedTexImage1D; +extern PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC nglCompressedTexSubImage3D; +extern PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC nglCompressedTexSubImage2D; +extern PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC nglCompressedTexSubImage1D; +extern PFNGLGETCOMPRESSEDTEXIMAGEPROC nglGetCompressedTexImage; + // GL_ARB_separate_shader_objects extern PFNGLUSEPROGRAMSTAGESPROC nglUseProgramStages; extern PFNGLACTIVESHADERPROGRAMPROC nglActiveShaderProgram; 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 16a512b0d..50f4346bc 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_texture.cpp @@ -917,7 +917,7 @@ bool CDriverGL3::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded sint size= tex.getPixels(i).size(); if (bUpload) { - nglCompressedTexImage2DARB (GL_TEXTURE_2D, i-decalMipMapResize, glfmt, + nglCompressedTexImage2D(GL_TEXTURE_2D, i-decalMipMapResize, glfmt, tex.getWidth(i),tex.getHeight(i), 0, size, ptr); bAllUploaded = true; } @@ -1188,7 +1188,7 @@ bool CDriverGL3::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap) nlassert (((x0&3) == 0) && ((y0&3) == 0)); if ((w>=4) && (h>=4)) { - nglCompressedTexSubImage2DARB ( + nglCompressedTexSubImage2D( GL_TEXTURE_2D, nNumMipMap-decalMipMapResize, x0, y0, (x1-x0), (y1-y0), glfmt, imageSize, ptr); } @@ -1198,7 +1198,7 @@ bool CDriverGL3::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap) // of the mipmap is less than 4 pixel so we use the other form. (its not really time critical // to upload 16 bytes so we can do it twice if texture is cut) imageSize = tex.getPixels(nNumMipMap).size(); - nglCompressedTexImage2DARB ( + nglCompressedTexImage2D( GL_TEXTURE_2D, nNumMipMap-decalMipMapResize, glfmt, w, h, 0, imageSize, ptr); }