April 2015
Beginner to intermediate
494 pages
10h 26m
English
Let's clear the display buffers with a color fading from black to white:
jni/GraphicsManager.cpp, refresh the screen during each update step with eglSwapBuffers().To have a visual feedback, change the display background color gradually with the help of glClearColor() before erasing the Framebuffer with glClear():
...
status GraphicsManager::update() {
static float clearColor = 0.0f;
clearColor += 0.001f;
glClearColor(clearColor, clearColor, clearColor, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
if (eglSwapBuffers(mDisplay, mSurface) != EGL_TRUE) {
Log::error("Error %d swapping buffers.", eglGetError());
return STATUS_KO;
} else {
return STATUS_OK;
}
}Android.mk file to link ...Read now
Unlock full access