mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
"gluPerspetive" llamado en cada refresco antes de "draw"
This commit is contained in:
parent
c5e8424ee0
commit
570a135e21
@ -20,7 +20,7 @@ LIBS += -lGLU
|
|||||||
}
|
}
|
||||||
|
|
||||||
macx{
|
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
|
INCLUDEPATH += /usr/local/include/poppler/qt4
|
||||||
LIBS += -L/usr/local/lib -lpoppler-qt4
|
LIBS += -L/usr/local/lib -lpoppler-qt4
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ LIBS += -lGLU
|
|||||||
}
|
}
|
||||||
|
|
||||||
macx{
|
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
|
INCLUDEPATH += /usr/local/include/poppler/qt4
|
||||||
LIBS += -L/usr/local/lib -lpoppler-qt4
|
LIBS += -L/usr/local/lib -lpoppler-qt4
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,13 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtOpenGL>
|
#include <QtOpenGL>
|
||||||
//#include <math.h>
|
//#include <math.h>
|
||||||
|
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
#include <OpenGL/glu.h>
|
||||||
|
#else
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QGLContext>
|
#include <QGLContext>
|
||||||
#include <QGLPixelBuffer>
|
#include <QGLPixelBuffer>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -246,7 +252,7 @@ YACReaderFlowGL::~YACReaderFlowGL()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize YACReaderFlowGL::minimumSizeHint() const
|
/*QSize YACReaderFlowGL::minimumSizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(800, 480);
|
return QSize(800, 480);
|
||||||
}
|
}
|
||||||
@ -254,7 +260,7 @@ QSize YACReaderFlowGL::minimumSizeHint() const
|
|||||||
QSize YACReaderFlowGL::sizeHint() const
|
QSize YACReaderFlowGL::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(800, 480);
|
return QSize(800, 480);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void YACReaderFlowGL::initializeGL()
|
void YACReaderFlowGL::initializeGL()
|
||||||
{
|
{
|
||||||
@ -285,6 +291,7 @@ void YACReaderFlowGL::paintGL()
|
|||||||
if(numObjects>0)
|
if(numObjects>0)
|
||||||
{
|
{
|
||||||
updatePositions();
|
updatePositions();
|
||||||
|
udpatePerspective(width(),height());
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,23 +302,22 @@ void YACReaderFlowGL::resizeGL(int width, int height)
|
|||||||
fontSize = width * 0.02;
|
fontSize = width * 0.02;
|
||||||
|
|
||||||
//int side = qMin(width, height);
|
//int side = qMin(width, height);
|
||||||
|
udpatePerspective(width,height);
|
||||||
|
|
||||||
|
if(numObjects>0)
|
||||||
|
updatePositions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void YACReaderFlowGL::udpatePerspective(int width, int height)
|
||||||
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
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);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
if(numObjects>0)
|
|
||||||
updatePositions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -119,6 +119,8 @@ protected:
|
|||||||
void animate(RVect *Current,RVect to);
|
void animate(RVect *Current,RVect to);
|
||||||
void drawCover(CFImage *CF);
|
void drawCover(CFImage *CF);
|
||||||
|
|
||||||
|
void udpatePerspective(int width, int height);
|
||||||
|
|
||||||
int updateCount;
|
int updateCount;
|
||||||
WidgetLoader * loader;
|
WidgetLoader * loader;
|
||||||
int fontSize;
|
int fontSize;
|
||||||
@ -170,8 +172,8 @@ public:
|
|||||||
~YACReaderFlowGL();
|
~YACReaderFlowGL();
|
||||||
|
|
||||||
//size;
|
//size;
|
||||||
QSize minimumSizeHint() const;
|
//QSize minimumSizeHint() const;
|
||||||
QSize sizeHint() const;
|
//QSize sizeHint() const;
|
||||||
|
|
||||||
/*functions*/
|
/*functions*/
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user