Commit 77c3438b authored by Martin Schultz's avatar Martin Schultz

fixes #13 by using a non multisampled FBO for picking

parent 3674f2d6
......@@ -1563,12 +1563,19 @@ void glViewer::contextMenuEvent(QGraphicsSceneContextMenuEvent* _e)
void glViewer::mousePressEvent(QGraphicsSceneMouseEvent* _e)
{
makeCurrent();
QPoint p (_e->scenePos().x(), _e->scenePos().y());
QMouseEvent me(QEvent::MouseButtonPress ,p, _e->screenPos(), _e->button(),
_e->buttons(), _e->modifiers());
_e->accept ();
emit signalMakeActive();
const GLuint prevFBO = ACG::GLState::getFramebufferDraw();
QFramebufferObject* nonMultisampledFBO;
GLuint fboHandle;
int samples = 0;
createQFBO(nonMultisampledFBO,&fboHandle,glWidth(),glHeight(),&samples);
ACG::GLState::bindFramebuffer(GL_FRAMEBUFFER_EXT, fboHandle);
glScene_->update ();
// right button pressed => popup menu (ignore here)
......@@ -1608,6 +1615,10 @@ void glViewer::mousePressEvent(QGraphicsSceneMouseEvent* _e)
break;
}
}
//restore old FBO
ACG::GLState::bindFramebuffer(GL_FRAMEBUFFER_EXT,prevFBO);
//cleanup
deleteQFBO(nonMultisampledFBO);
}
......@@ -1894,7 +1905,7 @@ void glViewer::handleNormalNavigation( QMouseEvent* _event ) {
switch (_event->type()) {
case QEvent::MouseButtonPress: {
// Get the depth at the current mouse position ( projected )
// This is used to do the translation in world coordinates
// As the scene is rendered, we can get the depth directly from the framebuffer.
......
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