![]() |
OpenGL ES SDK for Android
ARM Developer Center
|
A sample to show how to use glScissor() and EGL_SWAP_BEHAVIOUR. More...
#include <GLES2/gl2.h>#include <GLES2/gl2ext.h>#include <EGL/egl.h>#include <string>#include <jni.h>#include <android/log.h>#include <sys/time.h>#include "EGLPreserve.h"#include "Text.h"#include "Shader.h"#include "Texture.h"#include "Matrix.h"#include "Platform.h"#include "Timer.h"#include "AndroidPlatform.h"Go to the source code of this file.
Functions | |
| bool | setupGraphics (int width, int height) |
| void | renderFrame (void) |
| JNIEXPORT void JNICALL | Java_com_arm_malideveloper_openglessdk_eglpreserve_EGLPreserve_init (JNIEnv *env, jclass jcls, jint width, jint height) |
| JNIEXPORT void JNICALL | Java_com_arm_malideveloper_openglessdk_eglpreserve_EGLPreserve_step (JNIEnv *env, jclass jcls) |
| JNIEXPORT void JNICALL | Java_com_arm_malideveloper_openglessdk_eglpreserve_EGLPreserve_uninit (JNIEnv *, jclass) |
Variables | |
| string | resourceDirectory = "/data/data/com.arm.malideveloper.openglessdk.eglpreserve/" |
| string | vertexShaderFilename = "EGLPreserve_cube.vert" |
| string | fragmentShaderFilename = "EGLPreserve_cube.frag" |
| string | scissorOff = "Scissor: off" |
| string | scissorOn = "Scissor: on " |
| string | preserveOff = "Preserve: off" |
| string | preserveOn = "Preserve: on " |
| GLuint | programID = 0 |
| GLint | iLocPosition = -1 |
| GLint | iLocFillColor = -1 |
| GLint | iLocProjection = -1 |
| GLint | iLocModelview = -1 |
| Matrix | perspective |
| Matrix | translation |
| unsigned int | windowWidth = 0 |
| unsigned int | windowHeight = 0 |
| Timer | animationTimer |
| Text * | text |
A sample to show how to use glScissor() and EGL_SWAP_BEHAVIOUR.
The sample changes between three states:
Scissoring specifies a rectangle on screen, only ares inside that rectangle are then affected by draw calls. When EGL_SWAP_BEHAVIOUR is set to EGL_BUFFER_PRESERVED the contents of the color buffer are preserved when eglSwapBuffers() is called. When EGL_SWAP_BEHAVIOUR is set to EGL_BUFFER_DESTROYED the contents of the color buffer could be destroyed or modified by eglSwapBuffers(). The effect is that in case 1 above the left half of the cube is preserved (not moving) in the color buffer while the right halve is updated (keeps spinning). In case 2 the left the left half of the screen is cleared and the right half is updated.
Definition in file EGLPreserve.cpp.
| JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_eglpreserve_EGLPreserve_init | ( | JNIEnv * | env, |
| jclass | jcls, | ||
| jint | width, | ||
| jint | height | ||
| ) |
Definition at line 310 of file EGLPreserve.cpp.
| JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_eglpreserve_EGLPreserve_step | ( | JNIEnv * | env, |
| jclass | jcls | ||
| ) |
Definition at line 323 of file EGLPreserve.cpp.
| JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_eglpreserve_EGLPreserve_uninit | ( | JNIEnv * | , |
| jclass | |||
| ) |
Definition at line 329 of file EGLPreserve.cpp.
Definition at line 207 of file EGLPreserve.cpp.
Definition at line 93 of file EGLPreserve.cpp.
| Timer animationTimer |
Definition at line 88 of file EGLPreserve.cpp.
| string fragmentShaderFilename = "EGLPreserve_cube.frag" |
Definition at line 66 of file EGLPreserve.cpp.
| GLint iLocFillColor = -1 |
Definition at line 76 of file EGLPreserve.cpp.
| GLint iLocModelview = -1 |
Definition at line 78 of file EGLPreserve.cpp.
| GLint iLocPosition = -1 |
Definition at line 75 of file EGLPreserve.cpp.
| GLint iLocProjection = -1 |
Definition at line 77 of file EGLPreserve.cpp.
| Matrix perspective |
Definition at line 81 of file EGLPreserve.cpp.
| string preserveOff = "Preserve: off" |
Definition at line 70 of file EGLPreserve.cpp.
| string preserveOn = "Preserve: on " |
Definition at line 71 of file EGLPreserve.cpp.
| GLuint programID = 0 |
Definition at line 74 of file EGLPreserve.cpp.
| string resourceDirectory = "/data/data/com.arm.malideveloper.openglessdk.eglpreserve/" |
Definition at line 64 of file EGLPreserve.cpp.
| string scissorOff = "Scissor: off" |
Definition at line 68 of file EGLPreserve.cpp.
| string scissorOn = "Scissor: on " |
Definition at line 69 of file EGLPreserve.cpp.
| Text* text |
Definition at line 91 of file EGLPreserve.cpp.
| Matrix translation |
Definition at line 82 of file EGLPreserve.cpp.
| string vertexShaderFilename = "EGLPreserve_cube.vert" |
Definition at line 65 of file EGLPreserve.cpp.
| unsigned int windowHeight = 0 |
Definition at line 85 of file EGLPreserve.cpp.
| unsigned int windowWidth = 0 |
Definition at line 84 of file EGLPreserve.cpp.