- private void drawTriangle( final FloatBuffer aTriangleBuffer )
- {
- final int mStrideBytes = 7 * mBytesPerFloat;
- final int mPositionDataSize = 3;
- final int mColorDataSize = 4;
- aTriangleBuffer.position( 0 );
- GLES20.glVertexAttribPointer( mPositionLocation, mPositionDataSize, GLES20.GL_FLOAT, false, mStrideBytes, aTriangleBuffer );
- GLES20.glEnableVertexAttribArray( mPositionLocation );
- aTriangleBuffer.position( 3 );
- GLES20.glVertexAttribPointer( mColorLocation, mColorDataSize, GLES20.GL_FLOAT, false, mStrideBytes, aTriangleBuffer );
- GLES20.glEnableVertexAttribArray( mColorLocation );
- Matrix.multiplyMM( mMVPMatrix,0, mViewMatrix,0, mModelMatrix,0 );
- Matrix.multiplyMM( mMVPMatrix,0, mProjectionMatrix,0, mMVPMatrix,0 );
- GLES20.glUniformMatrix4fv( mMVPMatrixLocation,1,false, mMVPMatrix,0 );
- GLES20.glDrawArrays( GLES20.GL_TRIANGLES,0,3 );
- }