Commit 0a06c0ba authored by Martin Schultz's avatar Martin Schultz
Browse files

made the textnode render triangles instead of quads

parent 22a6e13e
...@@ -319,7 +319,7 @@ draw(GLState& _state, const DrawModes::DrawMode& /*_drawMode*/) ...@@ -319,7 +319,7 @@ draw(GLState& _state, const DrawModes::DrawMode& /*_drawMode*/)
_state.push_modelview_matrix(); _state.push_modelview_matrix();
_state.scale(size_); _state.scale(size_);
glDrawArrays(GL_QUADS, 0, int(text_.size() * 4) ); glDrawArrays(GL_TRIANGLES, 0, int(text_.size() * 4) );
_state.pop_modelview_matrix(); _state.pop_modelview_matrix();
if (textMode_ == SCREEN_ALIGNED || textMode_ == SCREEN_ALIGNED_STATIC_SIZE) { if (textMode_ == SCREEN_ALIGNED || textMode_ == SCREEN_ALIGNED_STATIC_SIZE) {
...@@ -497,6 +497,24 @@ updateVBO() { ...@@ -497,6 +497,24 @@ updateVBO() {
vertexBuffer_.push_back(avgWidth*0.15); vertexBuffer_.push_back(avgWidth*0.15);
vertexBuffer_.push_back(0.0f); vertexBuffer_.push_back(0.0f);
// texture coordinates
vertexBuffer_.push_back(rightTx);
vertexBuffer_.push_back(topTx);
// bottom left
vertexBuffer_.push_back(left);
vertexBuffer_.push_back(0.0f);
vertexBuffer_.push_back(0.0f);
// texture coordinates
vertexBuffer_.push_back(leftTx);
vertexBuffer_.push_back(bottomTx);
// top right
vertexBuffer_.push_back(right);
vertexBuffer_.push_back(avgWidth*0.15);
vertexBuffer_.push_back(0.0f);
// texture coordinates // texture coordinates
vertexBuffer_.push_back(rightTx); vertexBuffer_.push_back(rightTx);
vertexBuffer_.push_back(topTx); vertexBuffer_.push_back(topTx);
...@@ -623,7 +641,7 @@ getRenderObjects(ACG::IRenderer* _renderer, ACG::GLState& _state , const ACG::S ...@@ -623,7 +641,7 @@ getRenderObjects(ACG::IRenderer* _renderer, ACG::GLState& _state , const ACG::S
localMaterial.specularColor(ACG::Vec4f(0.0, 0.0, 0.0, 0.0 )); localMaterial.specularColor(ACG::Vec4f(0.0, 0.0, 0.0, 0.0 ));
ro.setMaterial(&localMaterial); ro.setMaterial(&localMaterial);
ro.glDrawArrays(GL_QUADS, 0, static_cast<GLsizei>(text_.size()) * 4); ro.glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(text_.size()) * 4);
_renderer->addRenderObject(&ro); _renderer->addRenderObject(&ro);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment