Code example for SurfaceTexture

Methods: setOnFrameAvailableListener

2
            GLES20.glVertexAttribPointer(mTexCoordHandle, 2, GLES20.GL_FLOAT,
                    false, 0, mTextureVertices);
            GLES20.glVertexAttribPointer(mTriangleVerticesHandle, 2, GLES20.GL_FLOAT,
                    false, 0, mQuadVertices);
            checkGlError("initialization"); 
            mSurfaceTexture = new SurfaceTexture(mTextureName);
            mSurfaceTexture.setOnFrameAvailableListener(new OnFrameAvailableListener() {
                @Override 
                public void onFrameAvailable(SurfaceTexture surfaceTexture) {
                    mCameraFrameCount.incrementAndGet();
                } 
            }); 
        } 
 
        /* (non-Javadoc) 
         * @see android.opengl.GLSurfaceView.Renderer#onSurfaceChanged(javax.microedition.khronos.opengles.GL10, int, int) 
         */ 
        @Override 
        public void onSurfaceChanged(GL10 gl, int width, int height) {
            mViewWidth = width;
            mViewHeight = height;