diff --git a/src/LogoBox.cc b/src/LogoBox.cc index 8319b8e..1128f86 100644 --- a/src/LogoBox.cc +++ b/src/LogoBox.cc @@ -25,6 +25,7 @@ enum Locations { LOC_NORMAL }; static float _width, _depth, _height; +static float center_xlate[3]; static bool loaded = false; /* @@ -41,9 +42,9 @@ LogoBox::LogoBox() { const float * aabb = obj.getAABB(); - float c_x = (aabb[0] + aabb[3]) / 2.0f; - float c_y = (aabb[1] + aabb[4]) / 2.0f; - float c_z = (aabb[2] + aabb[5]) / 2.0f; + center_xlate[0] = -(aabb[0] + aabb[3]) / 2.0f; + center_xlate[1] = -(aabb[1] + aabb[4]) / 2.0f; + center_xlate[2] = -(aabb[2] + aabb[5]) / 2.0f; _width = aabb[3] - aabb[0]; _depth = aabb[4] - aabb[1]; @@ -125,6 +126,8 @@ void LogoBox::draw() stride, (GLvoid *) obj.getVertexOffset()); glVertexAttribPointer(LOC_NORMAL, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid *) obj.getNormalOffset()); + glPushMatrix(); + glTranslatef(center_xlate[0], center_xlate[1], center_xlate[2]); for (map::iterator it = obj.getMaterials().begin(); it != obj.getMaterials().end(); it++) @@ -134,4 +137,5 @@ void LogoBox::draw() GL_UNSIGNED_SHORT, (GLvoid *) (sizeof(GLushort) * it->second.first_vertex)); } + glPopMatrix(); }