Index: trunk/src/lib/gui/gl/glgui_bar.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_bar.cc	(revision 10317)
+++ trunk/src/lib/gui/gl/glgui_bar.cc	(revision 10368)
@@ -71,5 +71,5 @@
 
     this->_value = value;
-    this->_frontRect.setSize((this->getSizeX2D() - borderLeft() - borderRight()) * (_value -_minimum)/ (_minimum + _maximum)
+    this->_frontRect.setSize((this->getSizeX2D() - borderLeft() - borderRight()) * (_value - _minimum) / (_maximum -_minimum)
         ,this->getSizeY2D() - borderTop() - borderBottom());
   }
@@ -99,6 +99,6 @@
 
     this->_frontRect.setTopLeft(borderLeft(), borderTop());
-    this->_frontRect.setSize((this->getSizeX2D() - borderLeft() - borderRight()) * (_value -_minimum)/ (_minimum + _maximum)
-                             ,this->getSizeY2D() - borderTop() - borderBottom());
+    this->_frontRect.setSize((this->getSizeX2D() - borderLeft() - borderRight()) * (_value - _minimum) / (_maximum -_minimum)
+        ,this->getSizeY2D() - borderTop() - borderBottom());
 
   }
Index: trunk/src/lib/gui/gl/glgui_box.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_box.cc	(revision 10317)
+++ trunk/src/lib/gui/gl/glgui_box.cc	(revision 10368)
@@ -18,5 +18,8 @@
 #include "glgui_box.h"
 #include <cassert>
+#include <iostream>
 #include "debug.h"
+#include "network_log.h"
+
 
 namespace OrxGui
@@ -177,5 +180,5 @@
   void GLGuiBox::resize()
   {
-    if (orientation() == OrxGui::Vertical)
+    if (this->orientation() == OrxGui::Vertical)
     {
       float height = borderTop();
@@ -186,7 +189,27 @@
       for (widget = this->_children.begin(); widget != this->_children.end(); ++widget)
       {
-        (*widget)->setRelCoor2D(borderLeft(), height);
-        height += (*widget)->getSizeY2D();
-        width = fmax(width, (*widget)->getSizeX2D());
+        //float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360;
+        //float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir));
+        //float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir));
+        float realSizeX, realSizeY;
+        int angleAbs = (int)(*widget)->getAbsDir2D();
+        int angleRel = (int)(*widget)->getRelDir2D();
+        //std::cout << "absangle: " << angleAbs << ", relangle: " << angleRel << '\n';
+        if ((*widget)->getAbsDir2D() == 0 || (*widget)->getAbsDir2D() == 180)
+        {
+          realSizeX = (*widget)->getSizeX2D();
+          realSizeY = (*widget)->getSizeY2D();
+          //std::cout<<"box vertical, widget 0or180";
+        }
+        else if ((*widget)->getAbsDir2D() == 90 || (*widget)->getAbsDir2D() == 270)
+        {
+          realSizeX = (*widget)->getSizeY2D();
+          realSizeY = (*widget)->getSizeX2D();
+          //std::cout<<"box vertical, widget 90or270";
+        }
+
+        (*widget)->setRelCoor2D(borderLeft(), height + borderTop());
+        height += realSizeY;
+        width = fmax(width, realSizeX);
       }
 
@@ -205,7 +228,28 @@
       for (widget = this->_children.begin(); widget != this->_children.end(); ++widget)
       {
+        //float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360;
+        //std::cout << "size X: " << (*widget)->getSizeX2D() << "size Y: " << (*widget)->getSizeY2D() << '\n';
+        //float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir));
+        //float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir));
+        float realSizeX, realSizeY;
+        int angleAbs = (int)(*widget)->getAbsDir2D();
+        int angleRel = (int)(*widget)->getRelDir2D();
+        //std::cout << "absangle: " << angleAbs << ", relangle: " << angleRel << '\n';
+        if ((*widget)->getAbsDir2D() == 0 || (*widget)->getAbsDir2D() == 180)
+        {
+          realSizeX = (*widget)->getSizeX2D();
+          realSizeY = (*widget)->getSizeY2D();
+          //std::cout<<"box horicontal, widget 0or180";
+        }
+        else if ((*widget)->getAbsDir2D() == 90 || (*widget)->getAbsDir2D() == 270)
+        {
+          realSizeX = (*widget)->getSizeY2D();
+          realSizeY = (*widget)->getSizeX2D();
+          //std::cout<<"box horicontal, widget 90or270";
+        }
+
         (*widget)->setRelCoor2D(width, borderTop());
-        height = fmax(height, (*widget)->getSizeY2D());
-        width += (*widget)->getSizeX2D();
+        height = fmax(height, realSizeY);
+        width += realSizeX;
       }
 
Index: trunk/src/lib/gui/gl/glgui_widget.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_widget.cc	(revision 10317)
+++ trunk/src/lib/gui/gl/glgui_widget.cc	(revision 10368)
@@ -915,4 +915,11 @@
   }
 
+  void GLGuiWidget::beginDraw() const 
+  { 
+    glPushMatrix(); 
+    glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
+    glRotatef(this->getAbsDir2D(), 0, 0, 1);
+  }
+
 
 }
Index: trunk/src/lib/gui/gl/glgui_widget.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_widget.h	(revision 10317)
+++ trunk/src/lib/gui/gl/glgui_widget.h	(revision 10368)
@@ -244,5 +244,5 @@
 
     /// RENDERING
-    inline void beginDraw() const { glPushMatrix(); glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); };
+    void beginDraw() const;
     inline void endDraw() const { glPopMatrix(); };
 
