Always draw OpenGL shapes' vertices in a counterclockwise order

This commit is contained in:
Alexandre Quessy
2013-11-26 22:08:02 -05:00
parent b6bcd27706
commit ed1056527d
5 changed files with 22 additions and 23 deletions
+5 -6
View File
@@ -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)
);