Time for action – adapting resolution with off-screen rendering
Let's render the game scene off-screen:
- Change
jni/GraphicsManager.hpp
, followed by these steps:- Define new getter methods for the screen width and height with their corresponding member variables
- Create a new function
initializeRenderBuffer()
, which creates an off-screen buffer to render the scene:... class GraphicsManager { public: ... int32_t getRenderWidth() { return mRenderWidth; }s int32_t getRenderHeight() { return mRenderHeight; } int32_t getScreenWidth() { return mScreenWidth; } int32_t getScreenHeight() { return mScreenHeight; } GLfloat* getProjectionMatrix() { return mProjectionMatrix[0]; } ...
- While still being in the same file, follow these steps:
- Declare a new
RenderVertex ...
- Declare a new
Get Android NDK Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.