disabled anti-aliasing from FlowGL until a solution for using glReadPixels will be found

This commit is contained in:
Luis Ángel San Martín 2015-01-13 19:57:00 +01:00
parent b9cc52bf23
commit ef74b04fcb

View File

@ -7,7 +7,7 @@
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#include <OpenGL/glu.h> #include <OpenGL/glu.h>
#else #else
#include <GL/glu.h> #include <GL/glu.h>
#endif #endif
#include <QGLContext> #include <QGLContext>
@ -241,7 +241,7 @@ YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p)
QSurfaceFormat f = format(); QSurfaceFormat f = format();
//TODO add antialiasing //TODO add antialiasing
f.setSamples(4); //f.setSamples(4);
f.setVersion(2, 1); f.setVersion(2, 1);
f.setSwapInterval(0); f.setSwapInterval(0);
setFormat(f); setFormat(f);
@ -1084,6 +1084,7 @@ void YACReaderFlowGL::keyPressEvent(QKeyEvent *event)
void YACReaderFlowGL::mousePressEvent(QMouseEvent *event) void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
{ {
makeCurrent();
if(event->button() == Qt::LeftButton) if(event->button() == Qt::LeftButton)
{ {
float x,y; float x,y;
@ -1101,9 +1102,10 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
winX = (float)x; winX = (float)x;
winY = (float)viewport[3] - (float)y; 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) if(posX >= 0.5)
{ {
@ -1117,35 +1119,37 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
showPrevious(); showPrevious();
} else } else
QOpenGLWidget::mousePressEvent(event); QOpenGLWidget::mousePressEvent(event);
doneCurrent();
} }
void YACReaderFlowGL::mouseDoubleClickEvent(QMouseEvent* event) void YACReaderFlowGL::mouseDoubleClickEvent(QMouseEvent* event)
{ {
float x,y; makeCurrent();
x = event->x(); float x,y;
y = event->y(); x = event->x();
GLint viewport[4]; y = event->y();
GLdouble modelview[16]; GLint viewport[4];
GLdouble projection[16]; GLdouble modelview[16];
GLfloat winX, winY, winZ; GLdouble projection[16];
GLdouble posX, posY, posZ; GLfloat winX, winY, winZ;
GLdouble posX, posY, posZ;
glGetDoublev( GL_MODELVIEW_MATRIX, modelview ); glGetDoublev( GL_MODELVIEW_MATRIX, modelview );
glGetDoublev( GL_PROJECTION_MATRIX, projection ); glGetDoublev( GL_PROJECTION_MATRIX, projection );
glGetIntegerv( GL_VIEWPORT, viewport ); glGetIntegerv( GL_VIEWPORT, viewport );
winX = (float)x; winX = (float)x;
winY = (float)viewport[3] - (float)y; winY = (float)viewport[3] - (float)y;
glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ );
gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ); gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);
if(posX <= 0.5 && posX >= -0.5)
{
emit selected(centerIndex());
event->accept();
}
if(posX <= 0.5 && posX >= -0.5)
{
emit selected(centerIndex());
event->accept();
}
doneCurrent();
} }
YACReaderComicFlowGL::YACReaderComicFlowGL(QWidget *parent,struct Preset p ) YACReaderComicFlowGL::YACReaderComicFlowGL(QWidget *parent,struct Preset p )