![]() |
Mali OpenGL ES SDK v2.4.4
Mali Developer Center
Use of the code snippets present within these pages are subject to these EULA terms
|
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 "EGLPreserve.h"#include "Text.h"#include "Shader.h"#include "Texture.h"#include "Matrix.h"#include "Platform.h"#include "Timer.h"#include "EGLRuntime.h"Macros | |
| #define | WINDOW_W 800 |
| #define | WINDOW_H 600 |
Functions | |
| bool | setupGraphics (int width, int height) |
| void | renderFrame (void) |
| int | main (void) |
Variables | |
| string | resourceDirectory = "assets/" |
| 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.
| #define WINDOW_H 600 |
| #define WINDOW_W 800 |
| int main | ( | void | ) |
| void renderFrame | ( | void | ) |
| Timer animationTimer |
| string fragmentShaderFilename = "EGLPreserve_cube.frag" |
| GLint iLocFillColor = -1 |
| GLint iLocModelview = -1 |
| GLint iLocPosition = -1 |
| GLint iLocProjection = -1 |
| Matrix perspective |
| string preserveOff = "Preserve: off" |
| string preserveOn = "Preserve: on " |
| GLuint programID = 0 |
| string resourceDirectory = "assets/" |
| string scissorOff = "Scissor: off" |
| string scissorOn = "Scissor: on " |
| Text* text |
| Matrix translation |
| string vertexShaderFilename = "EGLPreserve_cube.vert" |
| unsigned int windowHeight = 0 |
| unsigned int windowWidth = 0 |