Commit cf9cfd0f authored by Thibault Soucarre's avatar Thibault Soucarre

zoom is working again with ruler

parent ab2bdec2
......@@ -476,10 +476,10 @@ public:
/* Now, draw ruler */
/*Rendering is done in paintGL because we need to recalculate graduations each time paintGL is called, not just when launching the program*/
drawing_instance->start_ruler();
{
drawing_instance->call_ruler();
//drawing_instance->call_ruler();
}
drawing_instance->end_ruler();
......
......@@ -172,7 +172,6 @@ void Render_alternate::resizeGL(int width, int height) {
}
void Render_alternate::paintGL(){
//glClearColor(0.0, 1.0, 0.0, 1.0);
......@@ -182,6 +181,10 @@ void Render_alternate::paintGL(){
glUseProgram(_shader.getProgramID());
std::cout << "paintGL" << std::endl;
glm::mat4 tmp = _modelview;
start_ruler();
call_ruler();
end_ruler();
_ruler.config();
//_modelview = glm::translate(_modelview, glm::vec3(0.0, Info::Render::height, 100.0));
//_modelview = glm::rotate(_modelview, (float)180.0, glm::vec3(1.0, 0.0, 0.0));
_ruler.lock();
......@@ -722,6 +725,7 @@ GLuint Render_alternate::draw_wait() {
void Render_alternate::call_ruler(){
_ruler.setNbVertex(0);
Element_pos graduation_diff;
Element_pos coeff_prefix;
const Element_pos offset_x = _default_entity_x_translate;
......@@ -731,7 +735,6 @@ void Render_alternate::call_ruler(){
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);
//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);
......@@ -1006,7 +1009,6 @@ void Render_alternate::start_ruler(){
void Render_alternate::end_ruler(){
_draw_ruler = false;
std::cout << "end_ruler" << std::endl;
_ruler.config();
}
void Render_alternate::end_draw(){
......
......@@ -300,8 +300,7 @@ void Render_opengl::paintGL(){
/* Untranslate ruler */
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//call_ruler();
glCallList(_list_ruler);
call_ruler();
glDisable(GL_BLEND);
if (Info::Render::_vertical_line){
......@@ -950,17 +949,10 @@ void Render_opengl::end_draw_counter(){
}
void Render_opengl::start_ruler(){
_list_ruler = glGenLists(1);/* create the list */
if (_list_ruler == 0) {
*Message::get_instance() << tr("Error when creating ruler list.").toStdString() << Message::endw;
}
_draw_ruler = true;
glNewList(_list_ruler, GL_COMPILE);/* open the list */
}
void Render_opengl::end_ruler(){
glEndList(); /*close the list*/
_draw_ruler = false;
}
......
......@@ -172,12 +172,6 @@ protected:
*/
GLuint _list_arrows;
/*!
* \brief The ruler GLu list.
*/
GLuint _list_ruler;
/*!
* \brief The wait GLu list.
*/
......
......@@ -126,8 +126,10 @@ Vbo::Vbo(int nb_object, Type object_type){
Vbo::~Vbo(){
glDeleteBuffers(1, &_id);/* release the buffer and free its memory inside the graphic card */
_id = 0;
glDeleteBuffers(1, &_vboID);/* release the buffer and free its memory inside the graphic card */
_vboID = 0;
glDeleteVertexArrays(1, &_vaoID);
_vaoID = 0;
}
......@@ -240,6 +242,10 @@ int Vbo::getNbVertex(){
return _nbVertex;
}
void Vbo::setNbVertex(int n){
_nbVertex = n;
}
/***********************************
*
......
......@@ -219,6 +219,7 @@ public:
void lock();
void unlock();
int getNbVertex();
void setNbVertex(int);
/***********************************
*
......
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