2
0
Эх сурвалжийг харах

RENDER TARGETs by default could have NPOT size except Android

dmuratshin 9 жил өмнө
parent
commit
db5ae44442

+ 5 - 2
oxygine/src/PostProcess.cpp

@@ -150,8 +150,11 @@ namespace oxygine
         if (!t->getHandle())
             return false;
 
-        w = nextPOT(w);
-        h = nextPOT(h);
+        if (!HAVE_NPOT_RT())
+        {
+            w = nextPOT(w);
+            h = nextPOT(h);
+        }
 
         if (t->getFormat() == tf &&
                 t->getWidth() >= w && t->getHeight() >= h &&

+ 1 - 1
oxygine/src/core/STDFileSystem.cpp

@@ -88,7 +88,7 @@ namespace oxygine
         {
             if (*mode == 's')
                 ++mode;
-            
+
             LOGD("oxFileOpen %s", filename);
             oxHandle* h = oxFileOpen_(filename, mode);
             if (h)

+ 1 - 1
oxygine/src/core/file.cpp

@@ -102,7 +102,7 @@ namespace oxygine
 
         handle open(const char* file_, const char* mode, error_policy ep)
         {
-            
+
 #ifdef OX_DEBUG
             if (!strstr(mode, "b"))
                 log::warning("file::open for file '%s' should be called with 'b' (means binary) flag", file_);

+ 5 - 2
oxygine/src/core/gl/NativeTextureGLES.cpp

@@ -119,8 +119,11 @@ namespace oxygine
 
         if (rt)
         {
-            w = nextPOT(w);
-            h = nextPOT(h);
+            if (!HAVE_NPOT_RT())
+            {
+                w = nextPOT(w);
+                h = nextPOT(h);
+            }
         }
 
         glPixel p = SurfaceFormat2GL(tf);

+ 2 - 2
oxygine/src/core/oxygine.cpp

@@ -526,14 +526,14 @@ namespace oxygine
 
         bool  beginRendering(window w)
         {
-            
+
 #ifdef OXYGINE_SDL
             SDL_Window* wnd = w;
             if (!wnd)
             {
                 if (!focus)
                     return false;
-                
+
                 wnd = _window;
             }
             SDL_GL_MakeCurrent(wnd, _context);

+ 7 - 0
oxygine/src/oxygine_include.h

@@ -23,6 +23,13 @@
 // Introduces some CPU overhead.
 //#define OXYGINE_NO_SUBPIXEL_RENDERING 1
 
+
+#ifdef __ANDROID__
+#define HAVE_NPOT_RT()  (false)
+#else
+#define HAVE_NPOT_RT()  (true)
+#endif
+
 //#define OXYGINE_NO_YEILD 1
 
 // Bypass SDL file functions and use plain fopen, fread etc.