Fix the picking

This commit is contained in:
Maxime Gimeno 2016-06-14 09:09:27 +02:00 committed by Sébastien Loriot
parent b44896d915
commit c7b61b7caf
2 changed files with 4 additions and 1 deletions

View File

@ -121,6 +121,7 @@ void Volume_plane_intersection::draw(Viewer_interface* viewer) const {
c_mat.data()[i] = (float)mat[i];
}
d->program->setUniformValue("f_matrix", b_mat*c_mat);
d->program->setAttributeValue("colors", this->color());
viewer->glDrawArrays(GL_LINES, 0, 2);
d->program->release();
vaos[Volume_plane_intersection_priv::AArray]->release();
@ -142,6 +143,7 @@ void Volume_plane_intersection::draw(Viewer_interface* viewer) const {
c_mat.data()[i] = (float)mat[i];
}
d->program->setUniformValue("f_matrix", a_mat*c_mat);
d->program->setAttributeValue("colors", this->color());
viewer->glDrawArrays(GL_LINES, 0, 2);
d->program->release();
vaos[Volume_plane_intersection_priv::BArray]->release();
@ -163,6 +165,7 @@ void Volume_plane_intersection::draw(Viewer_interface* viewer) const {
b_mat.data()[i] = (float)mat[i];
}
d->program->setUniformValue("f_matrix", a_mat*b_mat);
d->program->setAttributeValue("colors", this->color());
viewer->glDrawArrays(GL_LINES, 0, 2);
d->program->release();
vaos[Volume_plane_intersection_priv::CArray]->release();

View File

@ -480,13 +480,13 @@ void Viewer::drawWithNames()
void Viewer::postSelection(const QPoint& pixel)
{
Q_EMIT selected(this->selectedName());
bool found = false;
qglviewer::Vec point = camera()->pointUnderPixel(pixel, found);
if(found) {
Q_EMIT selectedPoint(point.x,
point.y,
point.z);
Q_EMIT selected(this->selectedName());
const qglviewer::Vec orig = camera()->position();
const qglviewer::Vec dir = point - orig;
Q_EMIT selectionRay(orig.x, orig.y, orig.z,