mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
fixed index/total text in flow
This commit is contained in:
parent
58281d8b42
commit
0236bcdbbc
@ -291,12 +291,7 @@ QSize YACReaderFlowGL::minimumSizeHint() const
|
|||||||
|
|
||||||
void YACReaderFlowGL::initializeGL()
|
void YACReaderFlowGL::initializeGL()
|
||||||
{
|
{
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
glEnable(GL_CULL_FACE);
|
|
||||||
glEnable(GL_COLOR_MATERIAL);
|
|
||||||
glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
@ -318,23 +313,48 @@ void YACReaderFlowGL::initializeGL()
|
|||||||
|
|
||||||
void YACReaderFlowGL::paintGL()
|
void YACReaderFlowGL::paintGL()
|
||||||
{
|
{
|
||||||
/*glClearDepth(1.0);
|
QPainter painter;
|
||||||
glClearColor(1,1,1,1);*/
|
painter.begin(this);
|
||||||
|
|
||||||
|
painter.beginNativePainting();
|
||||||
|
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
glEnable(GL_COLOR_MATERIAL);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glEnable(GL_MULTISAMPLE);
|
||||||
|
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
/*glLoadIdentity();
|
|
||||||
glTranslatef(0.0, 0.0, -10.0);
|
|
||||||
glPopMatrix();*/
|
|
||||||
if(numObjects>0)
|
if(numObjects>0)
|
||||||
{
|
{
|
||||||
updatePositions();
|
updatePositions();
|
||||||
udpatePerspective(width(),height());
|
udpatePerspective(width(),height());
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glDisable(GL_MULTISAMPLE);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glDisable(GL_COLOR_MATERIAL);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
painter.endNativePainting();
|
||||||
|
|
||||||
|
QFont font = painter.font() ;
|
||||||
|
font.setPixelSize(fontSize);
|
||||||
|
painter.setFont(font);
|
||||||
|
|
||||||
|
painter.setPen(QColor(76,76,76));
|
||||||
|
painter.drawText(10,fontSize + 10, QString("%1/%2").arg(currentSelected+1).arg(numObjects));
|
||||||
|
|
||||||
|
painter.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderFlowGL::resizeGL(int width, int height)
|
void YACReaderFlowGL::resizeGL(int width, int height)
|
||||||
{
|
{
|
||||||
|
|
||||||
fontSize = (width + height) * 0.010;
|
fontSize = (width + height) * 0.010;
|
||||||
if(fontSize < 10)
|
if(fontSize < 10)
|
||||||
fontSize = 10;
|
fontSize = 10;
|
||||||
@ -568,30 +588,7 @@ void YACReaderFlowGL::draw()
|
|||||||
//Draw Center Cover
|
//Draw Center Cover
|
||||||
drawCover(images[CS]);
|
drawCover(images[CS]);
|
||||||
|
|
||||||
//glDisable(GL_DEPTH_TEST);
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
glOrtho(-(float(width())/height())/2.0,(float(width())/height())/2.0, 0, 1, -10, 10);
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
//glColor4f( 0.3f, 0.3f, 0.3f, 1.0f );
|
|
||||||
|
|
||||||
/*QOpenGLWidget migration renderText(10, fontSize + 10,QString("%1/%2").arg(currentSelected+1).arg(numObjects),QFont("Arial", fontSize));
|
|
||||||
|
|
||||||
QPainter painter;
|
|
||||||
painter.begin(this);
|
|
||||||
|
|
||||||
painter.setPen(QColor(76,76,76));
|
|
||||||
painter.drawText(10,10, QString("%1/%2").arg(currentSelected+1).arg(numObjects));
|
|
||||||
|
|
||||||
painter.end();*/
|
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPopMatrix();
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderFlowGL::showPrevious()
|
void YACReaderFlowGL::showPrevious()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user