diff --git a/source/Irrlicht/COGLES2Driver.cpp b/source/Irrlicht/COGLES2Driver.cpp index b637b0b3..8b51b723 100644 --- a/source/Irrlicht/COGLES2Driver.cpp +++ b/source/Irrlicht/COGLES2Driver.cpp @@ -80,7 +80,7 @@ COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params, } ) - core::dimension2d WindowSize(0, 0); + core::dimension2d windowSize(0, 0); #if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) || defined(_IRR_COMPILE_WITH_FB_DEVICE_) if (!ContextManager) @@ -92,7 +92,7 @@ COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params, ExposedData = ContextManager->getContext(); ContextManager->activateContext(ExposedData); - WindowSize = params.WindowSize; + windowSize = params.WindowSize; #elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_) glGenFramebuffers(1, &ViewFramebuffer); glGenRenderbuffers(1, &ViewRenderbuffer); @@ -120,12 +120,12 @@ COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params, glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ViewRenderbuffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, ViewDepthRenderbuffer); - WindowSize = core::dimension2d(backingWidth, backingHeight); - CNullDriver::ScreenSize = WindowSize; - CNullDriver::ViewPort = core::rect(core::position2d(0,0), core::dimension2di(WindowSize)); + windowSize = core::dimension2d(backingWidth, backingHeight); + CNullDriver::ScreenSize = windowSize; + CNullDriver::ViewPort = core::rect(core::position2d(0,0), core::dimension2di(windowSize)); #endif - genericDriverInit(WindowSize, params.Stencilbuffer); + genericDriverInit(windowSize, params.Stencilbuffer); } COGLES2Driver::~COGLES2Driver() @@ -174,8 +174,8 @@ COGLES2Driver::~COGLES2Driver() printVersion(); // print renderer information - vendorName = glGetString(GL_VENDOR); - os::Printer::log(vendorName.c_str(), ELL_INFORMATION); + VendorName = glGetString(GL_VENDOR); + os::Printer::log(VendorName.c_str(), ELL_INFORMATION); CurrentTexture.clear(); @@ -667,12 +667,12 @@ bool COGLES2Driver::endScene() if (HWBuffer->Mapped_Vertex != scene::EHM_NEVER) { if (HWBuffer->ChangedID_Vertex != HWBuffer->MeshBuffer->getChangedID_Vertex() - || !((SHWBufferLink_opengl*)HWBuffer)->vbo_verticesID) + || !static_cast(HWBuffer)->vbo_verticesID) { HWBuffer->ChangedID_Vertex = HWBuffer->MeshBuffer->getChangedID_Vertex(); - if (!updateVertexHardwareBuffer((SHWBufferLink_opengl*)HWBuffer)) + if (!updateVertexHardwareBuffer(static_cast(HWBuffer))) return false; } } @@ -680,7 +680,7 @@ bool COGLES2Driver::endScene() if (HWBuffer->Mapped_Index != scene::EHM_NEVER) { if (HWBuffer->ChangedID_Index != HWBuffer->MeshBuffer->getChangedID_Index() - || !((SHWBufferLink_opengl*)HWBuffer)->vbo_indicesID) + || !static_cast(HWBuffer)->vbo_indicesID) { HWBuffer->ChangedID_Index = HWBuffer->MeshBuffer->getChangedID_Index(); @@ -730,7 +730,7 @@ bool COGLES2Driver::endScene() if (!_HWBuffer) return; - SHWBufferLink_opengl *HWBuffer = (SHWBufferLink_opengl*)_HWBuffer; + SHWBufferLink_opengl *HWBuffer = static_cast(_HWBuffer); if (HWBuffer->vbo_verticesID) { glDeleteBuffers(1, &HWBuffer->vbo_verticesID); @@ -752,7 +752,7 @@ bool COGLES2Driver::endScene() if (!_HWBuffer) return; - SHWBufferLink_opengl *HWBuffer = (SHWBufferLink_opengl*)_HWBuffer; + SHWBufferLink_opengl *HWBuffer = static_cast(_HWBuffer); updateHardwareBuffer(HWBuffer); //check if update is needed diff --git a/source/Irrlicht/COGLES2Driver.h b/source/Irrlicht/COGLES2Driver.h index e980150c..0c99d3d6 100644 --- a/source/Irrlicht/COGLES2Driver.h +++ b/source/Irrlicht/COGLES2Driver.h @@ -76,7 +76,10 @@ namespace video struct SHWBufferLink_opengl : public SHWBufferLink { - SHWBufferLink_opengl(const scene::IMeshBuffer *meshBuffer): SHWBufferLink(meshBuffer), vbo_verticesID(0), vbo_indicesID(0) {} + SHWBufferLink_opengl(const scene::IMeshBuffer *meshBuffer) + : SHWBufferLink(meshBuffer), vbo_verticesID(0), vbo_indicesID(0) + , vbo_verticesSize(0), vbo_indicesSize(0) + {} u32 vbo_verticesID; //tmp u32 vbo_indicesID; //tmp @@ -302,10 +305,10 @@ namespace video //! Returns an image created from the last rendered frame. virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER); - //! checks if an OpenGL error has happend and prints it + //! checks if an OpenGL error has happened and prints it bool testGLError(); - //! checks if an OGLES1 error has happend and prints it + //! checks if an OGLES1 error has happened and prints it bool testEGLError(); //! Set/unset a clipping plane. @@ -323,7 +326,7 @@ namespace video //! Returns the graphics card vendor name. virtual core::stringc getVendorInfo() { - return vendorName; + return VendorName; }; ITexture* createDepthTexture(ITexture* texture, bool shared = true); @@ -450,7 +453,7 @@ namespace video core::stringw Name; core::matrix4 Matrices[ETS_COUNT]; - //! enumeration for rendering modes such as 2d and 3d for minizing the switching of renderStates. + //! enumeration for rendering modes such as 2d and 3d for minimizing the switching of renderStates. enum E_RENDER_MODE { ERM_NONE = 0, // no render state has been set yet. @@ -480,7 +483,7 @@ namespace video core::dimension2d CurrentRendertargetSize; - core::stringc vendorName; + core::stringc VendorName; core::matrix4 TextureFlipMatrix; @@ -514,7 +517,7 @@ namespace video #endif }; - //! This bridge between Irlicht pseudo OpenGL calls + //! This bridge between Irrlicht pseudo OpenGL calls //! and true OpenGL calls. class COGLES2CallBridge diff --git a/source/Irrlicht/COGLES2Texture.cpp b/source/Irrlicht/COGLES2Texture.cpp index 688fc8b8..805a6e3f 100644 --- a/source/Irrlicht/COGLES2Texture.cpp +++ b/source/Irrlicht/COGLES2Texture.cpp @@ -949,13 +949,11 @@ COGLES2FBOTexture::COGLES2FBOTexture(const core::dimension2d& size, PixelFormat = GL_RGB; PixelType = GL_UNSIGNED_BYTE; break; - break; case ECF_A1R5G5B5: InternalFormat = GL_RGBA; PixelFormat = GL_RGBA; PixelType = GL_UNSIGNED_SHORT_5_5_5_1; break; - break; case ECF_R5G6B5: InternalFormat = GL_RGB; PixelFormat = GL_RGB; diff --git a/source/Irrlicht/COGLESDriver.cpp b/source/Irrlicht/COGLESDriver.cpp index bba53a8f..cd7b3e2f 100644 --- a/source/Irrlicht/COGLESDriver.cpp +++ b/source/Irrlicht/COGLESDriver.cpp @@ -45,7 +45,7 @@ COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params, setDebugName("COGLESDriver"); #endif - core::dimension2d WindowSize(0, 0); + core::dimension2d windowSize(0, 0); #if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) || defined(_IRR_COMPILE_WITH_FB_DEVICE_) if (!ContextManager) @@ -57,7 +57,7 @@ COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params, ExposedData = ContextManager->getContext(); ContextManager->activateContext(ExposedData); - WindowSize = params.WindowSize; + windowSize = params.WindowSize; #elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_) glGenFramebuffersOES(1, &ViewFramebuffer); glGenRenderbuffersOES(1, &ViewRenderbuffer); @@ -85,12 +85,12 @@ COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params, glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, ViewRenderbuffer); glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, ViewDepthRenderbuffer); - WindowSize = core::dimension2d(backingWidth, backingHeight); - CNullDriver::ScreenSize = WindowSize; - CNullDriver::ViewPort = core::rect(core::position2d(0,0), core::dimension2di(WindowSize)); + windowSize = core::dimension2d(backingWidth, backingHeight); + CNullDriver::ScreenSize = windowSize; + CNullDriver::ViewPort = core::rect(core::position2d(0,0), core::dimension2di(windowSize)); #endif - genericDriverInit(WindowSize, params.Stencilbuffer); + genericDriverInit(windowSize, params.Stencilbuffer); } COGLES1Driver::~COGLES1Driver() @@ -138,8 +138,8 @@ bool COGLES1Driver::genericDriverInit(const core::dimension2d& screenSize, printVersion(); // print renderer information - vendorName = glGetString(GL_VENDOR); - os::Printer::log(vendorName.c_str(), ELL_INFORMATION); + VendorName = glGetString(GL_VENDOR); + os::Printer::log(VendorName.c_str(), ELL_INFORMATION); CurrentTexture.clear(); @@ -547,12 +547,12 @@ bool COGLES1Driver::updateHardwareBuffer(SHWBufferLink *HWBuffer) if (HWBuffer->Mapped_Vertex!=scene::EHM_NEVER) { if (HWBuffer->ChangedID_Vertex != HWBuffer->MeshBuffer->getChangedID_Vertex() - || !((SHWBufferLink_opengl*)HWBuffer)->vbo_verticesID) + || !static_cast(HWBuffer)->vbo_verticesID) { HWBuffer->ChangedID_Vertex = HWBuffer->MeshBuffer->getChangedID_Vertex(); - if (!updateVertexHardwareBuffer((SHWBufferLink_opengl*)HWBuffer)) + if (!updateVertexHardwareBuffer(static_cast(HWBuffer))) return false; } } @@ -565,7 +565,7 @@ bool COGLES1Driver::updateHardwareBuffer(SHWBufferLink *HWBuffer) HWBuffer->ChangedID_Index = HWBuffer->MeshBuffer->getChangedID_Index(); - if (!updateIndexHardwareBuffer((SHWBufferLink_opengl*)HWBuffer)) + if (!updateIndexHardwareBuffer(static_cast(HWBuffer))) return false; } } @@ -610,7 +610,7 @@ void COGLES1Driver::deleteHardwareBuffer(SHWBufferLink *_HWBuffer) if (!_HWBuffer) return; - SHWBufferLink_opengl *HWBuffer=(SHWBufferLink_opengl*)_HWBuffer; + SHWBufferLink_opengl *HWBuffer=static_cast(_HWBuffer); if (HWBuffer->vbo_verticesID) { extGlDeleteBuffers(1, &HWBuffer->vbo_verticesID); @@ -632,7 +632,7 @@ void COGLES1Driver::drawHardwareBuffer(SHWBufferLink *_HWBuffer) if (!_HWBuffer) return; - SHWBufferLink_opengl *HWBuffer=(SHWBufferLink_opengl*)_HWBuffer; + SHWBufferLink_opengl *HWBuffer=static_cast(_HWBuffer); updateHardwareBuffer(HWBuffer); //check if update is needed diff --git a/source/Irrlicht/COGLESDriver.h b/source/Irrlicht/COGLESDriver.h index f37b0e3f..f0779b53 100644 --- a/source/Irrlicht/COGLESDriver.h +++ b/source/Irrlicht/COGLESDriver.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2008 Nikolaus Gebhardt +// Copyright (C) 2002-20014 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in Irrlicht.h @@ -266,7 +266,7 @@ namespace video //! Returns an image created from the last rendered frame. virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER); - //! checks if an OpenGL error has happend and prints it + //! checks if an OpenGL error has happened and prints it bool testGLError(); //! Set/unset a clipping plane. @@ -276,7 +276,7 @@ namespace video virtual void enableClipPlane(u32 index, bool enable); //! Returns the graphics card vendor name. - virtual core::stringc getVendorInfo() {return vendorName;}; + virtual core::stringc getVendorInfo() {return VendorName;}; //! Get the maximal texture size for this driver core::dimension2du getMaxTextureSize() const; @@ -399,7 +399,7 @@ namespace video core::matrix4 Matrices[ETS_COUNT]; core::array ColorBuffer; - //! enumeration for rendering modes such as 2d and 3d for minizing the switching of renderStates. + //! enumeration for rendering modes such as 2d and 3d for minimizing the switching of renderStates. enum E_RENDER_MODE { ERM_NONE = 0, // no render state has been set yet. @@ -422,7 +422,7 @@ namespace video core::dimension2d CurrentRendertargetSize; - core::stringc vendorName; + core::stringc VendorName; core::matrix4 TextureFlipMatrix; @@ -454,7 +454,7 @@ namespace video #endif }; - //! This bridge between Irlicht pseudo OpenGL ES1.x calls + //! This bridge between Irrlicht pseudo OpenGL ES1.x calls //! and true OpenGL ES1.x calls. class COGLES1CallBridge diff --git a/source/Irrlicht/COGLESExtensionHandler.cpp b/source/Irrlicht/COGLESExtensionHandler.cpp index 2d37ff53..e248151c 100644 --- a/source/Irrlicht/COGLESExtensionHandler.cpp +++ b/source/Irrlicht/COGLESExtensionHandler.cpp @@ -124,24 +124,25 @@ namespace video }; -COGLES1ExtensionHandler::COGLES1ExtensionHandler() : -#if defined(_IRR_OGLES1_USE_EXTPOINTER_) - pGlDrawTexiOES(0), pGlDrawTexfOES(0), - pGlDrawTexivOES(0), pGlDrawTexfvOES(0), - pGlBlendEquationOES(0), pGlBlendFuncSeparateOES(0), - pGlBindRenderbufferOES(0), pGlDeleteRenderbuffersOES(0), - pGlGenRenderbuffersOES(0), pGlRenderbufferStorageOES(0), - pGlBindFramebufferOES(0), pGlDeleteFramebuffersOES(0), - pGlGenFramebuffersOES(0), pGlCheckFramebufferStatusOES(0), - pGlFramebufferRenderbufferOES(0), pGlFramebufferTexture2DOES(0), - pGlGenerateMipMapOES(0), -#endif +COGLES1ExtensionHandler::COGLES1ExtensionHandler() : Version(0), MaxTextureUnits(0), MaxLights(0), MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0), MaxMultipleRenderTargets(1), MaxIndices(65535), MaxTextureSize(1), MaxTextureLODBias(0.f), CommonProfile(false), MultiTextureExtension(false), MultiSamplingExtension(false), StencilBuffer(false) +#if defined(_IRR_OGLES1_USE_EXTPOINTER_) + ,pGlDrawTexiOES(0), pGlDrawTexfOES(0), + pGlDrawTexivOES(0), pGlDrawTexfvOES(0), + pGlBlendEquationOES(0), pGlBlendFuncSeparateOES(0), + pGlBindRenderbufferOES(0), pGlDeleteRenderbuffersOES(0), + pGlGenRenderbuffersOES(0), pGlRenderbufferStorageOES(0), + pGlBindFramebufferOES(0), pGlDeleteFramebuffersOES(0), + pGlGenFramebuffersOES(0), pGlCheckFramebufferStatusOES(0), + pGlFramebufferRenderbufferOES(0), pGlFramebufferTexture2DOES(0), + pGlGenerateMipMapOES(0) +#endif + { for (u32 i=0; i& size, PixelFormat = GL_RGB; PixelType = GL_UNSIGNED_BYTE; break; - break; case ECF_A1R5G5B5: InternalFormat = GL_RGBA; PixelFormat = GL_RGBA; PixelType = GL_UNSIGNED_SHORT_5_5_5_1; break; - break; case ECF_R5G6B5: InternalFormat = GL_RGB; PixelFormat = GL_RGB; @@ -758,7 +756,7 @@ COGLES1FBOTexture::COGLES1FBOTexture(const core::dimension2d& size, glBindTexture(GL_TEXTURE_2D, TextureName); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, ImageSize.Width, ImageSize.Height, 0, PixelFormat, PixelType, 0); #ifdef _DEBUG