From 86c91cae392fb5a51fed1f87ab986ba6382bcab5 Mon Sep 17 00:00:00 2001 From: Tats Date: Fri, 2 May 2014 14:08:47 -0400 Subject: [PATCH] Cleanup --- MapperGLCanvas.cpp | 61 +++++++--------------------------------------- 1 file changed, 9 insertions(+), 52 deletions(-) diff --git a/MapperGLCanvas.cpp b/MapperGLCanvas.cpp index a979829..8b32c5d 100644 --- a/MapperGLCanvas.cpp +++ b/MapperGLCanvas.cpp @@ -40,8 +40,6 @@ void MapperGLCanvas::resizeGL(int width, int height) { qDebug() << "Resize to " << width << "x" << height << endl; glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); glMatrixMode (GL_PROJECTION); glLoadIdentity (); glOrtho ( @@ -49,19 +47,6 @@ void MapperGLCanvas::resizeGL(int width, int height) (GLfloat) height, 0.0f, // bottom, top -1.0, 1.0f); glMatrixMode (GL_MODELVIEW); - -// glClearColor(0.0, 0.0, 0.0, 0.0); -// -// glViewport(0, 0, width, height); -// glMatrixMode(GL_PROJECTION); -// glLoadIdentity(); -// glMatrixMode (GL_PROJECTION); -// glLoadIdentity (); -// glOrtho ( -// 0.0f, (GLfloat) width, // left, right -// (GLfloat) height, 0.0f, // bottom, top -// -1.0, 1.0f); -// glMatrixMode (GL_MODELVIEW); } void MapperGLCanvas::paintGL() @@ -77,23 +62,18 @@ void MapperGLCanvas::draw(QPainter* painter) void MapperGLCanvas::enterDraw(QPainter* painter) { - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); Q_UNUSED(painter); -// glClearColor(0.0, 0.0, 0.0, 0.0); -// glClear(GL_COLOR_BUFFER_BIT); -// glViewport(0, 0, (GLint) GetSize().x, (GLint) GetSize().y); + // Clear to black. + qglClearColor(Qt::black); -// glMatrixMode (GL_PROJECTION); -// glLoadIdentity (); -// glOrtho ( -// 0.0f, (float) GetSize().x, // left, right -// (float) GetSize().y, 0.0f, // bottom, top -// -1.0, 1.0f); -// glMatrixMode (GL_MODELVIEW); + // Clear buffer. + glClear(GL_COLOR_BUFFER_BIT); +} -//// glLoadIdentity (); // FIXME? is this needed here? +void MapperGLCanvas::exitDraw(QPainter* painter) +{ + Q_UNUSED(painter); } Shape* MapperGLCanvas::getCurrentShape() @@ -173,7 +153,7 @@ void MapperGLCanvas::mouseMoveEvent(QMouseEvent* event) static QPointF prevMousePosition(0,0); // point that keeps track of last position of the mouse if (shape) { - if (_shapefirstgrab == false) + if (!_shapefirstgrab) { shape->translate(event->x() - prevMousePosition.x(), event->y() - prevMousePosition.y()); update(); @@ -251,29 +231,6 @@ void MapperGLCanvas::paintEvent(QPaintEvent* /* event */) // updateGL(); } -//void MapperGLCanvas::switchImage(int imageId) -//{ -// MainWindow::getInstance().setCurrentPaint(imageId); -// emit imageChanged(); -//} - -//QSize MapperGLCanvas::sizeHint() const -//{ -// return QSize( 640, 480 ); -//} -// -//QSize MapperGLCanvas::minimumSizeHint() const -//{ -// return QSize( 320, 240 ); -//} - -void MapperGLCanvas::exitDraw(QPainter* painter) -{ - Q_UNUSED(painter); -// glFlush(); -// swapBuffers(); -} - void MapperGLCanvas::updateCanvas() { update();