Creating a Projection Matrix in Our Code
We’re now ready to add a perspective projection to our code. Android’s Matrix class contains two methods for this, frustumM and perspectiveM. Unfortunately, frustumM has a bug that affects some types of projections,[32] and perspectiveM was only introduced in Android Ice Cream Sandwich and is not available on earlier versions of Android. We could simply target Ice Cream Sandwich and above, but then we’d be leaving out a large part of the market that still runs earlier versions of Android.
Instead, we can create our own method to implement the matrix as defined in the previous section. Open up the project we created back at the beginning of this chapter and add a new class called MatrixHelper to the package ...
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.
Read now
Unlock full access