]> git.lizzy.rs Git - irrlicht.git/blobdiff - source/Irrlicht/COpenGLCoreRenderTarget.h
SDL: Support clipboard
[irrlicht.git] / source / Irrlicht / COpenGLCoreRenderTarget.h
index 95dbd395163f01e8a4bb45a17ff5051f5839aa65..0dd08ebceea1da1184dadc4b82db9d6097c4fd84 100644 (file)
@@ -5,7 +5,6 @@
 #ifndef __C_OGLCORE_RENDER_TARGET_H_INCLUDED__\r
 #define __C_OGLCORE_RENDER_TARGET_H_INCLUDED__\r
 \r
-#include "IrrCompileConfig.h"\r
 \r
 #if defined(_IRR_COMPILE_WITH_OPENGL_) || defined(_IRR_COMPILE_WITH_OGLES1_) || defined(_IRR_COMPILE_WITH_OGLES2_)\r
 \r
@@ -37,10 +36,10 @@ public:
                if (ColorAttachment > 0)\r
                        Driver->irrGlGenFramebuffers(1, &BufferID);\r
 \r
-               AssignedTexture.set_used(static_cast<u32>(ColorAttachment));\r
+               AssignedTextures.set_used(static_cast<u32>(ColorAttachment));\r
 \r
-               for (u32 i = 0; i < AssignedTexture.size(); ++i)\r
-                       AssignedTexture[i] = GL_NONE;\r
+               for (u32 i = 0; i < AssignedTextures.size(); ++i)\r
+                       AssignedTextures[i] = GL_NONE;\r
        }\r
 \r
        virtual ~COpenGLCoreRenderTarget()\r
@@ -48,28 +47,28 @@ public:
                if (ColorAttachment > 0 && BufferID != 0)\r
                        Driver->irrGlDeleteFramebuffers(1, &BufferID);\r
 \r
-               for (u32 i = 0; i < Texture.size(); ++i)\r
+               for (u32 i = 0; i < Textures.size(); ++i)\r
                {\r
-                       if (Texture[i])\r
-                               Texture[i]->drop();\r
+                       if (Textures[i])\r
+                               Textures[i]->drop();\r
                }\r
 \r
                if (DepthStencil)\r
                        DepthStencil->drop();\r
        }\r
 \r
-       virtual void setTexture(const core::array<ITexture*>& textures, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_\r
+       void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) override\r
        {\r
                bool needSizeUpdate = false;\r
 \r
                // Set color attachments.\r
-               if ((Texture != textures) || (CubeSurfaces != cubeSurfaces))\r
+               if (!Textures.equals(textures, numTextures) || !CubeSurfaces.equals(cubeSurfaces, numCubeSurfaces))\r
                {\r
                        needSizeUpdate = true;\r
 \r
-                       core::array<ITexture*> prevTextures(Texture);\r
+                       core::array<ITexture*> prevTextures(Textures);\r
 \r
-                       if (textures.size() > static_cast<u32>(ColorAttachment))\r
+                       if (numTextures > static_cast<u32>(ColorAttachment))\r
                        {\r
                                core::stringc message = "This GPU supports up to ";\r
                                message += static_cast<u32>(ColorAttachment);\r
@@ -78,9 +77,9 @@ public:
                                os::Printer::log(message.c_str(), ELL_WARNING);\r
                        }\r
 \r
-                       Texture.set_used(core::min_(textures.size(), static_cast<u32>(ColorAttachment)));\r
+                       Textures.set_used(core::min_(numTextures, static_cast<u32>(ColorAttachment)));\r
 \r
-                       for (u32 i = 0; i < Texture.size(); ++i)\r
+                       for (u32 i = 0; i < Textures.size(); ++i)\r
                        {\r
                                TOpenGLTexture* currentTexture = (textures[i] && textures[i]->getDriverType() == DriverType) ? static_cast<TOpenGLTexture*>(textures[i]) : 0;\r
 \r
@@ -93,12 +92,12 @@ public:
 \r
                                if (textureID != 0)\r
                                {\r
-                                       Texture[i] = textures[i];\r
-                                       Texture[i]->grab();\r
+                                       Textures[i] = textures[i];\r
+                                       Textures[i]->grab();\r
                                }\r
                                else\r
                                {\r
-                                       Texture[i] = 0;\r
+                                       Textures[i] = 0;\r
                                }\r
                        }\r
 \r
@@ -111,9 +110,9 @@ public:
                        RequestTextureUpdate = true;\r
                }\r
 \r
-               if (CubeSurfaces != cubeSurfaces)\r
+               if (!CubeSurfaces.equals(cubeSurfaces, numCubeSurfaces))\r
                {\r
-                       CubeSurfaces = cubeSurfaces;\r
+                       CubeSurfaces.set_data(cubeSurfaces, numCubeSurfaces);\r
                        RequestTextureUpdate = true;\r
                }\r
 \r
@@ -183,26 +182,26 @@ public:
                        {\r
                                // Set new color textures.\r
 \r
-                               const u32 textureSize = core::min_(Texture.size(), AssignedTexture.size());\r
+                               const u32 textureSize = core::min_(Textures.size(), AssignedTextures.size());\r
 \r
                                for (u32 i = 0; i < textureSize; ++i)\r
                                {\r
-                                       TOpenGLTexture* currentTexture = static_cast<TOpenGLTexture*>(Texture[i]);\r
+                                       TOpenGLTexture* currentTexture = static_cast<TOpenGLTexture*>(Textures[i]);\r
                                        GLuint textureID = currentTexture ? currentTexture->getOpenGLTextureName() : 0;\r
 \r
                                        if (textureID != 0)\r
                                        {\r
-                                               AssignedTexture[i] = GL_COLOR_ATTACHMENT0 + i;\r
+                                               AssignedTextures[i] = GL_COLOR_ATTACHMENT0 + i;\r
                                                GLenum textarget = currentTexture->getType() == ETT_2D ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP_POSITIVE_X + (int)CubeSurfaces[i];\r
-                                               Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], textarget, textureID, 0);\r
+                                               Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], textarget, textureID, 0);\r
 #ifdef _DEBUG\r
                                                Driver->testGLError(__LINE__);\r
 #endif\r
                                        }\r
-                                       else if (AssignedTexture[i] != GL_NONE)\r
+                                       else if (AssignedTextures[i] != GL_NONE)\r
                                        {\r
-                                               AssignedTexture[i] = GL_NONE;\r
-                                               Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, 0, 0);\r
+                                               AssignedTextures[i] = GL_NONE;\r
+                                               Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);\r
 \r
                                                os::Printer::log("Error: Could not set render target.", ELL_ERROR);\r
                                        }\r
@@ -210,12 +209,12 @@ public:
 \r
                                // Reset other render target channels.\r
 \r
-                               for (u32 i = textureSize; i < AssignedTexture.size(); ++i)\r
+                               for (u32 i = textureSize; i < AssignedTextures.size(); ++i)\r
                                {\r
-                                       if (AssignedTexture[i] != GL_NONE)\r
+                                       if (AssignedTextures[i] != GL_NONE)\r
                                        {\r
-                                               Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, 0, 0);\r
-                                               AssignedTexture[i] = GL_NONE;\r
+                                               Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);\r
+                                               AssignedTextures[i] = GL_NONE;\r
                                        }\r
                                }\r
 \r
@@ -274,6 +273,9 @@ public:
                                        AssignedDepth = false;\r
                                        AssignedStencil = false;\r
                                }\r
+#ifdef _DEBUG\r
+                               Driver->testGLError(__LINE__);\r
+#endif\r
 \r
                                RequestDepthStencilUpdate = false;\r
                        }\r
@@ -282,7 +284,7 @@ public:
 \r
                        if (ColorAttachment > 0 && BufferID != 0)\r
                        {\r
-                               const u32 textureSize = Texture.size();\r
+                               const u32 textureSize = Textures.size();\r
 \r
                                if (textureSize == 0)\r
                                        Driver->irrGlDrawBuffer(GL_NONE);\r
@@ -290,9 +292,9 @@ public:
                                        Driver->irrGlDrawBuffer(GL_COLOR_ATTACHMENT0);\r
                                else\r
                                {\r
-                                       const u32 bufferCount = core::min_(MultipleRenderTarget, core::min_(textureSize, AssignedTexture.size()));\r
+                                       const u32 bufferCount = core::min_(MultipleRenderTarget, core::min_(textureSize, AssignedTextures.size()));\r
 \r
-                                       Driver->irrGlDrawBuffers(bufferCount, AssignedTexture.pointer());\r
+                                       Driver->irrGlDrawBuffers(bufferCount, AssignedTextures.pointer());\r
                                }\r
 \r
 #ifdef _DEBUG\r
@@ -319,10 +321,10 @@ public:
 \r
        ITexture* getTexture() const\r
        {\r
-               for (u32 i = 0; i < Texture.size(); ++i)\r
+               for (u32 i = 0; i < Textures.size(); ++i)\r
                {\r
-                       if (Texture[i])\r
-                               return Texture[i];\r
+                       if (Textures[i])\r
+                               return Textures[i];\r
                }\r
 \r
                return 0;\r
@@ -369,7 +371,7 @@ protected:
                return false;\r
        }\r
 \r
-       core::array<GLenum> AssignedTexture;\r
+       core::array<GLenum> AssignedTextures;\r
        bool AssignedDepth;\r
        bool AssignedStencil;\r
 \r