![]() |
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
|
The application shows the projected lights effect. There is a spot light effect adjusted to display the texture instead of the normal light colour. There is also a shadow map technique used to make the scene more realistic by applying some shadows. More...
#include "CubeModel.h"#include "Mathematics.h"#include "EGLRuntime.h"#include "Matrix.h"#include "PlaneModel.h"#include "Platform.h"#include "ProjectedLights.h"#include "Shader.h"#include "Texture.h"#include "Timer.h"#include <string>Functions | |
| static void | cleanUp () |
| Clean up the OpenGLES state (delete generated objects) and free the memory. | |
| static void | drawCubeAndPlane (bool isCameraPointOfView) |
| Draw cube and plane model. | |
| static void | generateAndPrepareColorTextureObject () |
| Generate a colour texture object and fill it with data. | |
| static void | generateAndPrepareDepthTextureObject () |
| Generate a depth texture object, set its properties and bind it to the generated framebuffer object. | |
| static void | getRenderSceneProgramLocations (GLuint programObjectId, RenderSceneProgramLocations *locationsStoragePtr) |
| Retrieve locations for attributes and uniforms used in a program object responsible for rendering a scene. | |
| static void | initializeProgramObject (ProgramAndShaderObjectIds *objectIdsPtr, const char *fragmentShaderFileName, const char *vertexShaderFileName) |
| Create and compile shader objects. If successful, they are attached to the program object, which is then linked. | |
| static void | initializeViewMatrices () |
| Initilize data that will be used to translate vertices into eye- and NDC-space. | |
| static void | renderFrame () |
| Function called to render the new frame into the back buffer. | |
| static void | setupGeometryData () |
| Prepare the geometry data that will be used while rendering the scene. | |
| static void | setupGraphics () |
| Prepare the OpenGLES environment to start the animation. | |
| static void | updateSpotLightDirection () |
| Calculate the updated direction of the spot light and update the corresponding OpenGLES object settings so that the new spot light direction will be used. | |
| int | main (int argc, char **argv) |
The application shows the projected lights effect. There is a spot light effect adjusted to display the texture instead of the normal light colour. There is also a shadow map technique used to make the scene more realistic by applying some shadows.
The projected lights effect is implemented in two basic steps described as follows:
|
static |
Clean up the OpenGLES state (delete generated objects) and free the memory.
|
static |
Draw cube and plane model.
| isCameraPointOfView | True, if a scene from camera point of view is supposed to be rendered. False in case of rendering a scene from spot light perspective. |
|
static |
Generate a colour texture object and fill it with data.
|
static |
Generate a depth texture object, set its properties and bind it to the generated framebuffer object.
|
static |
Retrieve locations for attributes and uniforms used in a program object responsible for rendering a scene.
| programObjectId | ID of a program object for which locations are queried. |
| locationsStoragePtr | Pointer to structure object where retrieved locations will be stored. Cannot be NULL. |
|
static |
Create and compile shader objects. If successful, they are attached to the program object, which is then linked.
| objectIdsPtr | Deref where generated program and shader objects IDs will be stored. Cannot be NULL. |
| fragmentShaderFileName | Name of fragment shader file. Cannot be NULL. |
| vertexShaderFileName | Name of vertex shader file. Cannot be NULL. |
|
static |
Initilize data that will be used to translate vertices into eye- and NDC-space.
|
static |
Function called to render the new frame into the back buffer.
|
static |
Prepare the geometry data that will be used while rendering the scene.
Store data in the buffer objects so that it can be used during draw calls.
|
static |
Prepare the OpenGLES environment to start the animation.
|
static |
Calculate the updated direction of the spot light and update the corresponding OpenGLES object settings so that the new spot light direction will be used.
| CameraViewProperties cameraViewProperties |
| GeometryProperties cubeGeometryProperties |
| DirectionalLightProperties directionalLightProperties |
| SpotLightViewProperites lightViewProperties |
| GeometryProperties planeGeometryProperties |
| RenderSceneObjects renderSceneObjects |
| ProgramAndShaderObjectIds renderSceneProgramAndShadersIds |
| RenderSceneProgramLocations renderSceneProgramLocations |
| SpotLightProperties spotLightProperties |
| Timer timer |