Browse Source

fixed gl error for postprocessing
minor

dmuratshin 9 years ago
parent
commit
d22b07409b
3 changed files with 11 additions and 2 deletions
  1. 4 0
      oxygine/src/PostProcess.cpp
  2. 2 0
      oxygine/src/TweenOutline.cpp
  3. 5 2
      tools/resbuild/process_atlas.py

+ 4 - 0
oxygine/src/PostProcess.cpp

@@ -338,6 +338,8 @@ namespace oxygine
             return display;
             return display;
 
 
         screen = actor.computeBounds(actor.computeGlobalTransform()).cast<Rect>();
         screen = actor.computeBounds(actor.computeGlobalTransform()).cast<Rect>();
+        if (screen.getWidth() < 0)
+            int q = 0;
         screen.size += Point(1, 1);
         screen.size += Point(1, 1);
         screen.expand(_extend, _extend);
         screen.expand(_extend, _extend);
 
 
@@ -350,6 +352,8 @@ namespace oxygine
     void PostProcess::update(Actor* actor)
     void PostProcess::update(Actor* actor)
     {
     {
         _screen = getScreenRect(*actor);
         _screen = getScreenRect(*actor);
+        if (_screen.isEmpty())
+            return;
 
 
 //        OX_ASSERT(actor->_getStage());
 //        OX_ASSERT(actor->_getStage());
         _rt = getRTManager().get(_rt, _screen.getWidth(), _screen.getHeight(), _format);
         _rt = getRTManager().get(_rt, _screen.getWidth(), _screen.getHeight(), _format);

+ 2 - 0
oxygine/src/TweenOutline.cpp

@@ -56,6 +56,8 @@ namespace oxygine
             int w = _pp._screen.size.x;
             int w = _pp._screen.size.x;
             int h = _pp._screen.size.y;
             int h = _pp._screen.size.y;
 
 
+            if (w < 0 || h < 0)
+                return;
 
 
             IVideoDriver* driver = IVideoDriver::instance;
             IVideoDriver* driver = IVideoDriver::instance;
             const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(IVideoDriver::instance->getVertexDeclaration(vertexPCT2::FORMAT));
             const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(IVideoDriver::instance->getVertexDeclaration(vertexPCT2::FORMAT));

+ 5 - 2
tools/resbuild/process_atlas.py

@@ -185,8 +185,11 @@ def makeAlpha(a):
         res = v + multiple - rem
         res = v + multiple - rem
         return res
         return res
 
 
-    asmall = a.resize(
-        (int(a.size[0] / 4), int(a.size[1] / 4)), Image.ANTIALIAS)
+    try:
+        asmall = a.resize(
+            (int(a.size[0] / 4), int(a.size[1] / 4)), Image.ANTIALIAS)
+    except ValueError:
+        return None
 
 
     b = asmall.getextrema()
     b = asmall.getextrema()