Example usage for android.opengl Matrix orthoM

List of usage examples for android.opengl Matrix orthoM

Introduction

In this page you can find the example usage for android.opengl Matrix orthoM.

Prototype

public static void orthoM(float[] m, int mOffset, float left, float right, float bottom, float top, float near,
        float far) 

Source Link

Document

Computes an orthographic projection matrix.

Usage

From source file:com.wlanjie.streaming.camera.CameraView.java

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
    mSurfaceWidth = width;/*w w w. jav  a2 s .  c  o m*/
    mSurfaceHeight = height;
    mFrameBuffer = ByteBuffer.allocate(width * height * 4);
    mCallbacks.onPreview(width, height);

    mEglCore.onInputSizeChanged(width, height);
    GLES20.glViewport(0, 0, width, height);
    mEglCore.onDisplaySizeChange(width, height);

    float outputAspectRatio = width > height ? (float) width / height : (float) height / width;
    float aspectRatio = outputAspectRatio / outputAspectRatio;
    if (width > height) {
        Matrix.orthoM(mProjectionMatrix, 0, -1.0f, 1.0f, -aspectRatio, aspectRatio, -1.0f, 1.0f);
    } else {
        Matrix.orthoM(mProjectionMatrix, 0, -aspectRatio, aspectRatio, -1.0f, 1.0f, -1.0f, 1.0f);
    }
}