diff --git a/Common.cpp b/Common.cpp
index 1f0af5b..1259f35 100644
--- a/Common.cpp
+++ b/Common.cpp
@@ -33,11 +33,12 @@ Quad* Common::createQuadForTexture(Texture* texture, int frameWidth, int frameHe
float textureHalfWidth = texture->getWidth() / 2.0f;
float textureHalfHeight = texture->getHeight() / 2.0f;
+ // XXX We should always draw OpenGL shapes counterclockwise
return new Quad(
- Point(centerX-textureHalfWidth, centerY-textureHalfHeight),
- Point(centerX+textureHalfWidth, centerY-textureHalfHeight),
- Point(centerX+textureHalfWidth, centerY+textureHalfHeight),
- Point(centerX-textureHalfWidth, centerY+textureHalfHeight));
+ Point(centerX - textureHalfWidth, centerY - textureHalfHeight),
+ Point(centerX - textureHalfWidth, centerY + textureHalfHeight),
+ Point(centerX + textureHalfWidth, centerY + textureHalfHeight),
+ Point(centerX + textureHalfWidth, centerY - textureHalfHeight));
}
void Common::addImage(const std::string imagePath, int frameWidth, int frameHeight)
@@ -46,10 +47,8 @@ void Common::addImage(const std::string imagePath, int frameWidth, int frameHeig
TextureMapping* tm = new TextureMapping(
img,
-
// Destination.
createQuadForTexture(img, frameWidth, frameHeight),
-
// Input.
createQuadForTexture(img, frameWidth, frameHeight)
);
diff --git a/Mapper.cpp b/Mapper.cpp
index 2efd724..63dc97c 100644
--- a/Mapper.cpp
+++ b/Mapper.cpp
@@ -51,7 +51,7 @@ void QuadTextureMapper::draw()
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS);
{
- for (int i=0; i<4; i++)
+ for (int i = 0; i < 4; i++)
{
Util::correctGlTexCoord(
(inputQuad->getVertex(i).x - texture->getX()) / (GLfloat) texture->getWidth(),
diff --git a/MapperGLCanvas.cpp b/MapperGLCanvas.cpp
index 61e6763..3c0c538 100644
--- a/MapperGLCanvas.cpp
+++ b/MapperGLCanvas.cpp
@@ -33,7 +33,7 @@ void MapperGLCanvas::initializeGL()
//glEnable(GL_CULL_FACE);
}
-void MapperGLCanvas::resizeGL(int width, int height)
+void MapperGLCanvas::resizeGL(int /* width */, int /* height */)
{
// glClearColor(0.0, 0.0, 0.0, 0.0);
//
@@ -63,8 +63,8 @@ void MapperGLCanvas::draw()
exitDraw();
}
-void MapperGLCanvas::enterDraw() {
-
+void MapperGLCanvas::enterDraw()
+{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glViewport(0, 0, width(), height());
@@ -138,7 +138,7 @@ void MapperGLCanvas::keyPressEvent(QKeyEvent* event)
emit quadChanged();
}
-void MapperGLCanvas::paintEvent(QPaintEvent* event)
+void MapperGLCanvas::paintEvent(QPaintEvent* /* event */)
{
std::cout << "Paint event" << std::endl;
updateGL();
diff --git a/Shape.h b/Shape.h
index 279e235..b5a0402 100644
--- a/Shape.h
+++ b/Shape.h
@@ -17,12 +17,10 @@
* along with this program. If not, see .
*/
-
#ifndef SHAPE_H_
#define SHAPE_H_
#include
-#include
struct Point
{
@@ -41,8 +39,14 @@ public:
virtual void build() {}
- const Point& getVertex(int i) { return vertices[i]; }
- void setVertex(int i, Point v) { vertices[i] = v; }
+ const Point& getVertex(int i)
+ {
+ return vertices[i];
+ }
+ void setVertex(int i, Point v)
+ {
+ vertices[i] = v;
+ }
void setVertex(int i, double x, double y)
{
vertices[i].x = x;
@@ -54,7 +58,8 @@ class Quad : public Shape
{
public:
Quad() {}
- Quad(Point p1, Point p2, Point p3, Point p4) {
+ Quad(Point p1, Point p2, Point p3, Point p4)
+ {
vertices.push_back(p1);
vertices.push_back(p2);
vertices.push_back(p3);
diff --git a/main.cpp b/main.cpp
index b51855d..7ab11a5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,16 +1,12 @@
// NOTE: To run, it is recommended not to be in Compiz or Beryl, they have shown some instability.
+#include
#include
#include
-
#include "Common.h"
#include "DestinationGLCanvas.h"
#include "SourceGLCanvas.h"
-#include
-
-#include
-
#define DEFAULT_WIDTH 800
#define DEFAULT_HEIGHT 600
@@ -40,8 +36,7 @@ int main(int argc, char *argv[])
sourceCanvas.setFocusPolicy(Qt::ClickFocus);
destinationCanvas.setFocusPolicy(Qt::ClickFocus);
-
- splitter.setWindowTitle(QObject::tr("Libremapping"));
+ splitter.setWindowTitle(QObject::tr("LibreMapping"));
splitter.resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
splitter.show();