Example usage for android.opengl GLES20 glDisable

List of usage examples for android.opengl GLES20 glDisable

Introduction

In this page you can find the example usage for android.opengl GLES20 glDisable.

Prototype

public static native void glDisable(int cap);

Source Link

Usage

From source file:com.dmitrybrant.android.cardboardmpo.MainActivity.java

@Override
public void onDrawEye(Eye eye) {
    GLES20.glDisable(GLES20.GL_DEPTH_TEST);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    // Apply the eye transformation to the camera.
    Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);

    // TODO: Do something with the head transform (e.g. pan the photo around)
    // For now, just reset the view matrix, so that the photo is in the center at all times.
    Matrix.setIdentityM(view, 0);/*  w w w. java  2 s  . c  o  m*/

    float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
    if (eye.getType() == 1) {
        Matrix.multiplyMM(modelView, 0, view, 0, rectLeftEye.getModelMatrix(), 0);
        Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
        rectLeftEye.draw(modelViewProjection);
    } else {
        Matrix.multiplyMM(modelView, 0, view, 0, rectRightEye.getModelMatrix(), 0);
        Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
        rectRightEye.draw(modelViewProjection);
    }
}

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

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    GLES20.glDisable(GL10.GL_DITHER);
    GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);

    HandlerThread thread = new HandlerThread("glDraw");
    thread.start();/*from   w w  w  . j  av a2  s .  c  o m*/
    mHandler = new Handler(thread.getLooper()) {

        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            IntBuffer buffer = mEglCore.getRgbaBuffer();
            mFrameBuffer.asIntBuffer().put(buffer.array());
            if (mCallback != null) {
                mCallback.onPreviewFrame(CameraView.this, mFrameBuffer.array());
            }
        }
    };

    mEglCore = new EglCore(getResources());
    mEglCore.init();

    mSurfaceTexture.setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
        @Override
        public void onFrameAvailable(SurfaceTexture surfaceTexture) {
            mGLSurfaceView.requestRender();
        }
    });
}