OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Native.cpp File Reference
#include <jni.h>
#include <android/log.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "Matrix.h"

Go to the source code of this file.

Macros

#define LOG_TAG   "libNative"
 
#define LOGI(...)   __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
 
#define LOGE(...)   __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
 

Functions

GLuint loadShader (GLenum shaderType, const char *shaderSource)
 
GLuint createProgram (const char *vertexSource, const char *fragmentSource)
 
bool setupGraphics (int width, int height)
 
void renderFrame ()
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_lighting_NativeLibrary_init (JNIEnv *env, jobject obj, jint width, jint height)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_lighting_NativeLibrary_step (JNIEnv *env, jobject obj)
 

Variables

static const char glVertexShader []
 
static const char glFragmentShader []
 
GLuint lightingProgram
 
GLuint vertexLocation
 
GLuint vertexColourLocation
 
GLuint vertexNormalLocation
 
GLuint projectionLocation
 
GLuint modelViewLocation
 
float projectionMatrix [16]
 
float modelViewMatrix [16]
 
float angle = 0
 
GLfloat verticies []
 
GLfloat colour []
 
GLfloat normals []
 
GLushort indices []
 

Macro Definition Documentation

#define LOG_TAG   "libNative"

Definition at line 33 of file Native.cpp.

#define LOGE (   ...)    __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)

Definition at line 35 of file Native.cpp.

#define LOGI (   ...)    __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)

Definition at line 34 of file Native.cpp.

Function Documentation

GLuint createProgram ( const char *  vertexSource,
const char *  fragmentSource 
)

Definition at line 128 of file Native.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_lighting_NativeLibrary_init ( JNIEnv *  env,
jobject  obj,
jint  width,
jint  height 
)

Definition at line 371 of file Native.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_lighting_NativeLibrary_step ( JNIEnv *  env,
jobject  obj 
)

Definition at line 377 of file Native.cpp.

GLuint loadShader ( GLenum  shaderType,
const char *  shaderSource 
)

Definition at line 93 of file Native.cpp.

void renderFrame ( void  )

Definition at line 326 of file Native.cpp.

bool setupGraphics ( int  width,
int  height 
)

Definition at line 187 of file Native.cpp.

Variable Documentation

float angle = 0

Definition at line 185 of file Native.cpp.

GLfloat colour[]

Definition at line 249 of file Native.cpp.

const char glFragmentShader[]
static
Initial value:
=
"precision mediump float;\n"
"varying vec3 fragColour;\n"
"void main()\n"
"{\n"
" gl_FragColor = vec4(fragColour, 1.0);\n"
"}\n"

Definition at line 85 of file Native.cpp.

const char glVertexShader[]
static

Definition at line 38 of file Native.cpp.

GLushort indices[]
Initial value:
= {0, 2, 4, 0, 4, 1, 1, 4, 3, 2, 3, 4,
5, 7, 9, 5, 9, 6, 6, 9, 8, 7, 8, 9,
10, 12, 14, 10, 14, 11, 11, 14, 13, 12, 13, 14,
15, 17, 19, 15, 19, 16, 16, 19, 18, 17, 18, 19,
20, 22, 24, 20, 24, 21, 21, 24, 23, 22, 23, 24,
25, 27, 29, 25, 29, 26, 26, 29, 28, 27, 28, 29
}

Definition at line 317 of file Native.cpp.

GLuint lightingProgram

Definition at line 174 of file Native.cpp.

GLuint modelViewLocation

Definition at line 181 of file Native.cpp.

float modelViewMatrix[16]

Definition at line 184 of file Native.cpp.

GLfloat normals[]

Definition at line 283 of file Native.cpp.

GLuint projectionLocation

Definition at line 180 of file Native.cpp.

float projectionMatrix[16]

Definition at line 183 of file Native.cpp.

GLuint vertexColourLocation

Definition at line 176 of file Native.cpp.

GLuint vertexLocation

Definition at line 175 of file Native.cpp.

GLuint vertexNormalLocation

Definition at line 178 of file Native.cpp.

GLfloat verticies[]

Definition at line 215 of file Native.cpp.