From dbb2590c551a0b8f268078548e2c08892a99e452 Mon Sep 17 00:00:00 2001 From: cutealien Date: Fri, 21 Apr 2017 13:00:07 +0000 Subject: [PATCH] Disable NPOT support for webgl driver. This also allows to enable mip-mapping again. WebGL allows NPOT textures in very specific situations (no mips, no filters, no texture-repeats), but disabling it by default fixes a lot of problems. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5447 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/CWebGL1Driver.cpp | 8 +++++++- source/Irrlicht/CWebGL1Driver.h | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/Irrlicht/CWebGL1Driver.cpp b/source/Irrlicht/CWebGL1Driver.cpp index 4d070092..9e194d20 100644 --- a/source/Irrlicht/CWebGL1Driver.cpp +++ b/source/Irrlicht/CWebGL1Driver.cpp @@ -24,7 +24,13 @@ CWebGL1Driver::CWebGL1Driver(const SIrrlichtCreationParameters& params, io::IFil setDebugName("CWebGL1Driver"); #endif - setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false); // so far causing errors, have to figure out later + // NPOT are not allowed for WebGL in most cases. + // One can use them when: + // - The TEXTURE_MIN_FILTER is linear or nearest + // - no mipmapping is used + // - no texture wrapping is used (so all texture_wraps have to be CLAMP_TO_EDGE) + // So users could still enable them for specific cases (usually GUI), but in general better to have it off. + disableFeature(EVDF_TEXTURE_NPOT); MBLinesSize2 = createSimpleMeshBuffer(2, scene::EPT_LINES); MBTriangleFanSize4 = createSimpleMeshBuffer(4, scene::EPT_TRIANGLE_FAN); diff --git a/source/Irrlicht/CWebGL1Driver.h b/source/Irrlicht/CWebGL1Driver.h index 25268141..cdb7cb71 100644 --- a/source/Irrlicht/CWebGL1Driver.h +++ b/source/Irrlicht/CWebGL1Driver.h @@ -113,8 +113,6 @@ namespace video video::SColor leftDownEdge = video::SColor(0,0,0,0), video::SColor rightDownEdge = video::SColor(0,0,0,0)) _IRR_OVERRIDE_; - - protected: // create a meshbuffer which has as many vertices as indices scene::SMeshBuffer* createSimpleMeshBuffer(irr::u32 numVertices, scene::E_PRIMITIVE_TYPE primitiveType, scene::E_HARDWARE_MAPPING vertexMappingHint=scene::EHM_STREAM, scene::E_HARDWARE_MAPPING indexMappingHint=scene::EHM_STATIC) const;