From ef74b04fcbd1953a901a86c53891f8630ed074b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Tue, 13 Jan 2015 19:57:00 +0100 Subject: [PATCH] disabled anti-aliasing from FlowGL until a solution for using glReadPixels will be found --- common/yacreader_flow_gl.cpp | 54 +++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/common/yacreader_flow_gl.cpp b/common/yacreader_flow_gl.cpp index cbaf5713..8808fc5c 100644 --- a/common/yacreader_flow_gl.cpp +++ b/common/yacreader_flow_gl.cpp @@ -7,7 +7,7 @@ #ifdef Q_OS_MAC #include #else - #include + #include #endif #include @@ -241,7 +241,7 @@ YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p) QSurfaceFormat f = format(); //TODO add antialiasing - f.setSamples(4); + //f.setSamples(4); f.setVersion(2, 1); f.setSwapInterval(0); setFormat(f); @@ -1084,6 +1084,7 @@ void YACReaderFlowGL::keyPressEvent(QKeyEvent *event) void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) { + makeCurrent(); if(event->button() == Qt::LeftButton) { float x,y; @@ -1101,9 +1102,10 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) winX = (float)x; winY = (float)viewport[3] - (float)y; - glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); - gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); + glReadPixels(winX, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); + + gluUnProject(winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); if(posX >= 0.5) { @@ -1117,35 +1119,37 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) showPrevious(); } else QOpenGLWidget::mousePressEvent(event); + doneCurrent(); } void YACReaderFlowGL::mouseDoubleClickEvent(QMouseEvent* event) { - float x,y; - x = event->x(); - y = event->y(); - GLint viewport[4]; - GLdouble modelview[16]; - GLdouble projection[16]; - GLfloat winX, winY, winZ; - GLdouble posX, posY, posZ; + makeCurrent(); + float x,y; + x = event->x(); + y = event->y(); + GLint viewport[4]; + GLdouble modelview[16]; + GLdouble projection[16]; + GLfloat winX, winY, winZ; + GLdouble posX, posY, posZ; - glGetDoublev( GL_MODELVIEW_MATRIX, modelview ); - glGetDoublev( GL_PROJECTION_MATRIX, projection ); - glGetIntegerv( GL_VIEWPORT, viewport ); + glGetDoublev( GL_MODELVIEW_MATRIX, modelview ); + glGetDoublev( GL_PROJECTION_MATRIX, projection ); + glGetIntegerv( GL_VIEWPORT, viewport ); - winX = (float)x; - winY = (float)viewport[3] - (float)y; - glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); + winX = (float)x; + winY = (float)viewport[3] - (float)y; + glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); - gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); - - if(posX <= 0.5 && posX >= -0.5) - { - emit selected(centerIndex()); - event->accept(); - } + gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); + if(posX <= 0.5 && posX >= -0.5) + { + emit selected(centerIndex()); + event->accept(); + } + doneCurrent(); } YACReaderComicFlowGL::YACReaderComicFlowGL(QWidget *parent,struct Preset p )