Commit e0a0610a authored by Thibault Soucarre's avatar Thibault Soucarre

avoid paintGL to be executed before rendering the trace

parent 079ed283
......@@ -44,7 +44,6 @@
*\file Render_alternate.cpp
*/
#include "common/common.hpp"
#include "common/Info.hpp"
#include "common/Message.hpp"
......@@ -172,7 +171,11 @@ void Render_alternate::resizeGL(int width, int height) {
}
void Render_alternate::paintGL(){
/*Do not call paintGL before rendering the trace*/
if(DRAWING_STATE_WAITING == _state)
return;
//glClearColor(0.0, 1.0, 0.0, 1.0);
resizeGL(Render_alternate::QGLWidget::width(), Render_alternate::QGLWidget::height());
......@@ -193,9 +196,6 @@ void Render_alternate::paintGL(){
glDrawArrays(GL_QUADS, 0, 8);
glDrawArrays(GL_LINES, 8, _ruler.getNbVertex());
_ruler.unlock();
/* drawing containers*/
_containers.lock();
//_modelview = glm::translate(_modelview, glm::vec3(0.0f, _ruler_y + _ruler_height -_y_state_translate, _z_container));
......@@ -245,6 +245,7 @@ void Render_alternate::paintGL(){
//restore matrix
_modelview = tmp;
}
/*draw selection if necessary*/
if (_mouse_pressed && (Info::Render::_key_ctrl == false) && !_mouse_pressed_inside_container){
Element_pos x0, x1, y0, y1;
......@@ -268,7 +269,7 @@ void Render_alternate::paintGL(){
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
_modelview = tmp;
}
}
// _containers.display(_modelview);
//rendu
......@@ -314,16 +315,16 @@ void Render_alternate::paintGL(){
if (it==it_end || render_to_screen_y(trace_to_render_y(_texts[i].y)) - render_to_screen_y(trace_to_render_y((*it).second))> height ){
const QString text_elided = metric.elidedText(_texts[i].value.c_str(), Qt::ElideRight, _x_scale_container_state*Info::Screen::width/(Info::Trace::depth+1.));
renderText ( render_to_screen_x(_texts[i].x * _x_scale_container_state/0.20),
render_to_screen_y( trace_to_render_y(_texts[i].y) + 0.5),
text_elided,
arial_font);
render_to_screen_y( trace_to_render_y(_texts[i].y) + 0.5),
text_elided,
arial_font);
//push only displayed values in the map
//push only displayed values in the map
previous_by_column[_texts[i].x]=_texts[i].y;
//displayed++;
}//else{skipped++;}
}
/* Draw ruler text */
std::ostringstream buf_txt;
Element_pos graduation_diff;
Element_pos coeff_prefix;
......@@ -371,9 +372,7 @@ void Render_alternate::paintGL(){
buf_txt.str().c_str(),
arial_font);
}
}
// Render_alternate::QGLWidget::setFocus(Qt::ActiveWindowFocusReason);/* give the focus to the render area for mouse and keyboard events */
......@@ -754,14 +753,14 @@ GLuint Render_alternate::draw_wait() {
void Render_alternate::call_ruler(){
_ruler.setNbVertex(0);
Element_pos graduation_diff;
Element_pos coeff_prefix;
//Element_pos coeff_prefix;
const Element_pos offset_x = _default_entity_x_translate;
const Element_pos offset_y = _ruler_y + _ruler_height+3.5;
update_visible_interval_value();
graduation_diff = Ruler::get_graduation_diff(Info::Render::_x_min_visible, Info::Render::_x_max_visible);
coeff_prefix = Ruler::get_coeff_for_common_prefix(Info::Render::_x_min_visible, Info::Render::_x_max_visible);
//coeff_prefix = Ruler::get_coeff_for_common_prefix(Info::Render::_x_min_visible, Info::Render::_x_max_visible);
//draw quads
set_color(0.0, 0.0, 1.0);
_ruler.add(trace_to_render_x(Info::Render::_x_min_visible), 0, _r, _g, _b);
......@@ -788,7 +787,7 @@ void Render_alternate::call_ruler(){
trace_to_render_x(i) + offset_x, 4+offset_y, _z_ruler);
}
return;
return;
}
......@@ -1035,7 +1034,7 @@ void Render_alternate::start_ruler(){
void Render_alternate::end_ruler(){
_draw_ruler = false;
std::cout << "end_ruler" << std::endl;
//std::cout << "end_ruler" << std::endl;
}
void Render_alternate::end_draw(){
......
......@@ -158,10 +158,7 @@ int Vbo::get_remaining_size() const{
}
void Vbo::config(){
std::cout << "Configuration du vbo, " << _nbVertex << " vertices" << std::endl;
int vertex_size = _vertex.size() * sizeof(Element_pos);
std::cout << _vertex.size() << std::endl;
std::cout << _colors.size() << std::endl;
int colors_size = _colors.size() * sizeof(Element_col);
Element_pos * vertex = &_vertex[0];
Element_col * colors = &_colors[0];
......
Markdown is supported
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