How to flip a quad (openGL es 2.0 Android / Java)

How would one go about ‘flipping’ a quad, either horizontally or vertically? (Just a single quad, not everything in view).

I know how to rotate a quad, this is my rotation method:

public void rotate(float x, float y, int angle){

    //Convert co-ordinates (Following section just converts my coordinates

    //Left hand
    xPlotLeft = (-MyGLRenderer.ratio)+((x)*MyGLRenderer.coordStepAmountWidth);
    yPlotTop = +1-((y)*MyGLRenderer.coordStepAmountHeight);
    //Right hand
    xPlotRight = xPlotLeft+((quadWidth)*MyGLRenderer.coordStepAmountWidth);
    yPlotBottom = yPlotTop-((quadHeight)*MyGLRenderer.coordStepAmountHeight);

    //Center of quad (Along the x)
    centreX = xPlotLeft + ((xPlotRight-xPlotLeft)/2);
    //Center of quad (Along the y)
    centreY = yPlotBottom + ((yPlotTop-yPlotBottom)/2);

    //Rotate the quad

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.rotateM(mRotationMatrix, 0, -angle, 0, 0, 0.1f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);


I’m unsure how to do something similar just to flip (or ‘mirror’) the quad.


Create a scale matrix with a scale of -1 on the axis you want to mirror.

Source : Link , Question Author : BungleBonce , Answer Author : Tim R.

Leave a Comment