Commit 9d8a3237 authored by Adrian Page's avatar Adrian Page

Fix scrolling the OpenGL canvas. Something's not right though, the checkerboard jitters

about while scrolling.


svn path=/trunk/koffice/; revision=649073
parent 3eb33f9b
......@@ -120,22 +120,29 @@ void KisCanvas2::createQPainterCanvas()
m_d->currentCanvasIsOpenGL = false;
}
void KisCanvas2::createOpenGLCanvas()
{
#ifdef HAVE_OPENGL
if ( QGLFormat::hasOpenGL() ) {
// XXX: The image isn't done loading here!
if ( m_d->openGLImageContext ) delete m_d->openGLImageContext;
m_d->openGLImageContext = KisOpenGLImageContext::getImageContext(m_d->view->image(), m_d->monitorProfile);
setCanvasWidget( new KisOpenGLCanvas2( this, m_d->view, m_d->openGLImageContext ) );
m_d->currentCanvasIsOpenGL = true;
}
else {
kWarning() << "Tried to create OpenGL widget when system doesn't have OpenGL\n";
createQPainterCanvas();
}
#endif
}
void KisCanvas2::createCanvas()
{
KisConfig cfg;
if ( cfg.useOpenGL() ) {
#ifdef HAVE_OPENGL
if ( !QGLFormat::hasOpenGL() ) {
kWarning() << "Tried to create OpenGL widget when system doesn't have OpenGL\n";
createQPainterCanvas();
}
else {
// XXX: The image isn't done loading here!
if ( m_d->openGLImageContext ) delete m_d->openGLImageContext;
m_d->openGLImageContext = KisOpenGLImageContext::getImageContext(m_d->view->image(), m_d->monitorProfile);
setCanvasWidget( new KisOpenGLCanvas2( this, m_d->view, m_d->openGLImageContext ) );
m_d->currentCanvasIsOpenGL = true;
}
createOpenGLCanvas();
#else
kWarning() << "OpenGL requested while its not available, starting qpainter canvas";
createQPainterCanvas();
......
......@@ -145,6 +145,7 @@ private:
void createCanvas();
void createQPainterCanvas();
void createOpenGLCanvas();
/**
* Returns a rect in widget pixels that is translated for document
......
......@@ -107,7 +107,7 @@ void KisOpenGLCanvas2::paintGL()
{
kDebug() << "paintGL\n";
glDrawBuffer(GL_BACK);
//glDrawBuffer(GL_BACK);
QColor widgetBackgroundColor = palette().color(QPalette::Mid);
......@@ -142,8 +142,6 @@ void KisOpenGLCanvas2::paintGL()
glBindTexture(GL_TEXTURE_2D, m_d->openGLImageContext->backgroundTexture());
glTranslatef(m_d->documentOffset.x(), m_d->documentOffset.y(), 0.0);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
......@@ -163,8 +161,6 @@ void KisOpenGLCanvas2::paintGL()
glEnd();
glTranslatef(-m_d->documentOffset.x(), -m_d->documentOffset.y(), 0.0);
// glTranslatef(-horzValue(), -vertValue(), 0.0);
glScalef(scaleX, scaleY, 1.0);
glEnable(GL_BLEND);
......@@ -214,8 +210,7 @@ void KisOpenGLCanvas2::paintGL()
QPainter gc ( this );
m_d->toolProxy->paint(gc, *m_d->viewConverter );
swapBuffers();
//swapBuffers();
}
KoToolProxy * KisOpenGLCanvas2::toolProxy() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment