Commit 079ed283 authored by Thibault Soucarre's avatar Thibault Soucarre

Add selection rectangle. Alpha value isn't correct

parent cf9cfd0f
......@@ -245,6 +245,30 @@ 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;
x0 = screen_to_render_x(_mouse_x);
y0 = /*Info::Render::height -*/ screen_to_render_y(_mouse_y);
x1 = screen_to_render_x(_new_mouse_x);
y1 = /*Info::Render::height -*/ screen_to_render_y(_new_mouse_y);
float selection[8] = {x0, y0, x0, y1, x1, y1, x1, y0};
float selection_colors[12] = {0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5};
/*_modelview = glm::translate(_modelview, glm::vec3(_default_entity_x_translate - _x_state_translate,
_ruler_y + _ruler_height - _y_state_translate,
0));*/
//_modelview = glm::scale(_modelview, glm::vec3(_x_state_scale, _y_state_scale, 1));
glUniformMatrix4fv(glGetUniformLocation(_shader.getProgramID(), "modelview"), 1, GL_FALSE, glm::value_ptr(_modelview));
glUniformMatrix4fv(glGetUniformLocation(_shader.getProgramID(), "projection"), 1, GL_FALSE, glm::value_ptr(_projection));
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, selection);
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, selection_colors);
glEnableVertexAttribArray(1);
glDrawArrays(GL_QUADS, 0, 4);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
_modelview = tmp;
}
// _containers.display(_modelview);
//rendu
......@@ -347,7 +371,10 @@ 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 */
......
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