From 7cb3cc09eea928f046c576a12887e735529d3425 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Wed, 21 Aug 2013 12:40:39 -0500 Subject: [PATCH] Fixed a long-standing invalid OpenGL disable in drawRect. Fixed a really strange bug in ComponentList vertical centering that was causing TextEditComponent to render the top GuiBox border incorrectly with odd sizes. --- src/Renderer_draw_gl.cpp | 4 ++-- src/components/ComponentListComponent.cpp | 2 +- src/components/TextEditComponent.cpp | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Renderer_draw_gl.cpp b/src/Renderer_draw_gl.cpp index c12a4a82c..d851129b2 100644 --- a/src/Renderer_draw_gl.cpp +++ b/src/Renderer_draw_gl.cpp @@ -103,9 +103,9 @@ namespace Renderer { glDrawArrays(GL_TRIANGLES, 0, 6); - glDisableClientState(GL_BLEND); + glDisable(GL_BLEND); glDisableClientState(GL_VERTEX_ARRAY); - glDisable(GL_COLOR_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); } void setMatrix(float* matrix) diff --git a/src/components/ComponentListComponent.cpp b/src/components/ComponentListComponent.cpp index f371ea5fc..7ced286db 100644 --- a/src/components/ComponentListComponent.cpp +++ b/src/components/ComponentListComponent.cpp @@ -118,7 +118,7 @@ Eigen::Vector3f ComponentListComponent::getCellOffset(Eigen::Vector2i pos) offset[0] += gridSize.x() - entry->component->getSize().x(); //always center on the Y axis - offset[1] += gridSize.y() / 2 - entry->component->getSize().y() / 2; + offset[1] += gridSize.y() / 2.0f - entry->component->getSize().y() / 2.0f; return offset; } diff --git a/src/components/TextEditComponent.cpp b/src/components/TextEditComponent.cpp index 576a94c4d..9aea4b242 100644 --- a/src/components/TextEditComponent.cpp +++ b/src/components/TextEditComponent.cpp @@ -5,14 +5,13 @@ #include "../Renderer.h" TextEditComponent::TextEditComponent(Window* window) : GuiComponent(window), - mBox(window, 0, 0, 0, 0) + mBox(window, 0, 0, 0, 0), mFocused(false) { addChild(&mBox); onFocusLost(); - LOG(LogInfo) << getFont()->getHeight(); - setSize(256, /*(float)getFont()->getHeight()*/ 41); + setSize(256, (float)getFont()->getHeight()); } void TextEditComponent::onFocusGained() @@ -72,7 +71,7 @@ void TextEditComponent::render(const Eigen::Affine3f& parentTrans) Renderer::setMatrix(trans); std::shared_ptr f = getFont(); - f->drawText(mText, Eigen::Vector2f::Zero(), 0x00000000 | getOpacity()); + //f->drawText(mText, Eigen::Vector2f::Zero(), 0x00000000 | getOpacity()); } std::shared_ptr TextEditComponent::getFont()