Skip to Content
Android 9 Development Cookbook - Third Edition
book

Android 9 Development Cookbook - Third Edition

by Rick Boyer
October 2018
Intermediate to advanced
464 pages
15h 17m
English
Packt Publishing
Content preview from Android 9 Development Cookbook - Third Edition

How to do it...

As stated previously, we will continue, not from the previous recipe, but from the Applying the projection and camera view while drawing recipe. Open MainActivity.java and follow these steps:

  1. Add the following global variables to the MainActivity class:
private float mCenterX=0; 
private float mCenterY=0; 
  1. Add the following code to the GLRendered class:
private float[] mRotationMatrix = new float[16];public volatile float mAngle;public void setAngle(float angle) {    mAngle = angle;}
  1. In the same class, modify the onDrawFrame() method by replacing the existing mTriangle.draw(mMVPMatrix); statement with the following code:
float[] tempMatrix = new float[16];Matrix.setRotateM(mRotationMatrix, 0, mAngle, 0, 0, -1.0f);Matrix. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Android Application Development Cookbook - Second Edition

Android Application Development Cookbook - Second Edition

Rick Boyer, Kyle Mew
Android High Performance Programming

Android High Performance Programming

Enrique López Mañas, Diego Grancini
Android Things Projects

Android Things Projects

Francesco Azzola

Publisher Resources

ISBN: 9781788991216Supplemental Content