How can I flip or mirror the image object (not the screen) in the onDraw
method?
I tried scale(1, -1, 1)
, but that did not work.
My code:
opengl.selectVertex(vertexname)
.translate(x - 1, y, -9);
if (opengl.getPathModifier(vertexname).getAngle() > -180 &&
opengl.getPathModifier(vertexname).getAngle() < 0) {
opengl.selectVertex(vertexname).scale(-scale, scale, 1);
} else {
opengl.selectVertex(vertexname).scale(scale, scale, 1);
}
opengl.rotate(opengl.getPathModifier(vertexname).getAngle() + 90, 0, 0, 1);
Not 100% sure what you're asking here, but I think what you want to do is transform the projection matrix. If you want to flip so that things on the left appear on the right then you need to Scale the projection matrix by (-1, 1, 1). If you want things at the top to appear at the bottom you need to scale by (1,-1, 1) and if you want both you can scale (-1, -1, 1).
Edit based on extra information: If all you want to do is display the object exactly the same, but with texture flipped, you need to change the texture coordinates of the vertices in the objects - flip the texture coordinates by replacing the old u texture coordinate with 1-u.