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
structure with four components -x
,y
,u
, andv
Define the OpenGL resources necessary for the framebuffer, namely, the texture, the vertex buffer, the shader program, and its variables:
... private: status initializeRenderBuffer...