public void draw ( float [ ] mvpMatrix , FloatBuffer vertexBuffer , int firstVertex , int vertexCount , int coordsPerVertex , int vertexStride , float [ ] texMatrix , FloatBuffer texBuffer , int textureId , int texStride ) { GlUtil . checkGlError ( "draw start" ) ; // Select the program. GLES20 . glUseProgram ( mProgramHandle ) ; GlUtil . checkGlError ( "glUseProgram" ) ; // Set the texture. GLES20 . glActiveTexture ( GLES20 . GL_TEXTURE0 ) ; GLES20 . glBindTexture ( mTextureTarget , textureId ) ; // Copy the model / view / projection matrix over. GLES20 . glUniformMatrix4fv ( muMVPMatrixLoc , 1 , false , mvpMatrix , 0 ) ; GlUtil . checkGlError ( "glUniformMatrix4fv" ) ; // Copy the texture transformation matrix over. GLES20 . glUniformMatrix4fv ( muTexMatrixLoc , 1 , false , texMatrix , 0 ) ; GlUtil . checkGlError ( "glUniformMatrix4fv" ) ; // Enable the "aPosition" vertex attribute. GLES20 . glEnableVertexAttribArray ( maPositionLoc ) ; GlUtil . checkGlError ( "glEnableVertexAttribArray" ) ; // Connect vertexBuffer to "aPosition". GLES20 . glVertexAttribPointer ( maPositionLoc , coordsPerVertex , GLES20 . GL_FLOAT , false , vertexStride , vertexBuffer ) ; GlUtil . checkGlError ( "glVertexAttribPointer" ) ; // Enable the "aTextureCoord" vertex attribute. GLES20 . glEnableVertexAttribArray ( maTextureCoordLoc ) ; GlUtil . checkGlError ( "glEnableVertexAttribArray" ) ; // Connect texBuffer to "aTextureCoord". GLES20 . glVertexAttribPointer ( maTextureCoordLoc , 2 , GLES20 . GL_FLOAT , false , texStride , texBuffer ) ; GlUtil . checkGlError ( "glVertexAttribPointer" ) ; // Populate the convolution kernel, if present. if ( muKernelLoc >= 0 ) { GLES20 . glUniform1fv ( muKernelLoc , KERNEL_SIZE , mKernel , 0 ) ; GLES20 . glUniform2fv ( muTexOffsetLoc , KERNEL_SIZE , mTexOffset , 0 ) ; GLES20 . glUniform1f ( muColorAdjustLoc , mColorAdjust ) ; } // Populate touch position data, if present if ( muTouchPositionLoc >= 0 ) { GLES20 . glUniform2fv ( muTouchPositionLoc , 1 , mSummedTouchPosition , 0 ) ; } // Draw the rect. GLES20 . glDrawArrays ( GLES20 . GL_TRIANGLE_STRIP , firstVertex , vertexCount ) ; GlUtil . checkGlError ( "glDrawArrays" ) ; // Done -- disable vertex array, texture, and program. GLES20 . glDisableVertexAttribArray ( maPositionLoc ) ; GLES20 . glDisableVertexAttribArray ( maTextureCoordLoc ) ; GLES20 . glBindTexture ( mTextureTarget , 0 ) ; GLES20 . glUseProgram ( 0 ) ; }
Issues the draw call . Does the full setup on every call .