From 570a135e21ec2467fe15c6288ec1aaa535436502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Thu, 17 Jan 2013 19:30:00 +0100 Subject: [PATCH] "gluPerspetive" llamado en cada refresco antes de "draw" --- YACReader/YACReader.pro | 2 +- YACReaderLibrary/YACReaderLibrary.pro | 2 +- common/yacreader_flow_gl.cpp | 34 ++++++++++++++++----------- common/yacreader_flow_gl.h | 6 +++-- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro index 07b05243..fa4ec132 100644 --- a/YACReader/YACReader.pro +++ b/YACReader/YACReader.pro @@ -20,7 +20,7 @@ LIBS += -lGLU } macx{ -INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include" +#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include" INCLUDEPATH += /usr/local/include/poppler/qt4 LIBS += -L/usr/local/lib -lpoppler-qt4 } diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index 602784ec..482890f8 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -23,7 +23,7 @@ LIBS += -lGLU } macx{ -INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include" +#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include" INCLUDEPATH += /usr/local/include/poppler/qt4 LIBS += -L/usr/local/lib -lpoppler-qt4 } diff --git a/common/yacreader_flow_gl.cpp b/common/yacreader_flow_gl.cpp index ffeb5c1d..f592905c 100644 --- a/common/yacreader_flow_gl.cpp +++ b/common/yacreader_flow_gl.cpp @@ -3,7 +3,13 @@ #include #include //#include -#include + +#ifdef Q_WS_MAC + #include +#else + #include +#endif + #include #include #include @@ -246,7 +252,7 @@ YACReaderFlowGL::~YACReaderFlowGL() } -QSize YACReaderFlowGL::minimumSizeHint() const +/*QSize YACReaderFlowGL::minimumSizeHint() const { return QSize(800, 480); } @@ -254,7 +260,7 @@ QSize YACReaderFlowGL::minimumSizeHint() const QSize YACReaderFlowGL::sizeHint() const { return QSize(800, 480); -} +}*/ void YACReaderFlowGL::initializeGL() { @@ -285,6 +291,7 @@ void YACReaderFlowGL::paintGL() if(numObjects>0) { updatePositions(); + udpatePerspective(width(),height()); draw(); } } @@ -295,23 +302,22 @@ void YACReaderFlowGL::resizeGL(int width, int height) fontSize = width * 0.02; //int side = qMin(width, height); + udpatePerspective(width,height); + + if(numObjects>0) + updatePositions(); +} + +void YACReaderFlowGL::udpatePerspective(int width, int height) +{ glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); -#ifdef QT_OPENGL_ES_1 - //glOrthof(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0); -#else - //float sideX = ((float(width)/height)/2)*1.5; - //float sideY = 0.5*1.5; - gluPerspective(20.0, (float)width / (float)height, 1.0, 200.0); - //glOrtho(-sideX, sideX, -sideY+0.2, +sideY+0.2, 4, 11.0); -#endif + gluPerspective(20.0, GLdouble(width) / (float)height, 1.0, 200.0); + glMatrixMode(GL_MODELVIEW); - - if(numObjects>0) - updatePositions(); } //----------------------------------------------------------------------------- diff --git a/common/yacreader_flow_gl.h b/common/yacreader_flow_gl.h index 04c2f072..7797cf55 100644 --- a/common/yacreader_flow_gl.h +++ b/common/yacreader_flow_gl.h @@ -118,6 +118,8 @@ protected: void calcRV(RVect *RV,int pos); void animate(RVect *Current,RVect to); void drawCover(CFImage *CF); + + void udpatePerspective(int width, int height); int updateCount; WidgetLoader * loader; @@ -170,8 +172,8 @@ public: ~YACReaderFlowGL(); //size; - QSize minimumSizeHint() const; - QSize sizeHint() const; + //QSize minimumSizeHint() const; + //QSize sizeHint() const; /*functions*/