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 <cstdio>
#include <cstdlib>
#include <cmath>
#include "Matrix.h"
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <vector>

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_assetloading_NativeLibrary_init (JNIEnv *env, jobject obj, jint width, jint height)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_assetloading_NativeLibrary_step (JNIEnv *env, jobject obj)
 

Variables

const struct aiScene * scene = NULL
 
std::vector< GLfloatvertices
 
std::vector< GLushort > indices
 
static const char glVertexShader []
 
static const char glFragmentShader []
 
GLuint glProgram
 
GLuint vertexLocation
 
GLuint vertexColourLocation
 
GLuint projectionLocation
 
GLuint modelViewLocation
 
float projectionMatrix [16]
 
float modelViewMatrix [16]
 
float angle = 0
 

Macro Definition Documentation

#define LOG_TAG   "libNative"

Definition at line 45 of file Native.cpp.

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

Definition at line 47 of file Native.cpp.

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

Definition at line 46 of file Native.cpp.

Function Documentation

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

Definition at line 104 of file Native.cpp.

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

Definition at line 271 of file Native.cpp.

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

Definition at line 277 of file Native.cpp.

GLuint loadShader ( GLenum  shaderType,
const char *  shaderSource 
)

Definition at line 69 of file Native.cpp.

void renderFrame ( void  )

Definition at line 228 of file Native.cpp.

bool setupGraphics ( int  width,
int  height 
)

Definition at line 160 of file Native.cpp.

Variable Documentation

float angle = 0

Definition at line 158 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 61 of file Native.cpp.

GLuint glProgram

Definition at line 150 of file Native.cpp.

const char glVertexShader[]
static
Initial value:
=
"attribute vec4 vertexPosition;\n"
"attribute vec3 vertexColour;\n"
"varying vec3 fragColour;\n"
"uniform mat4 projection;\n"
"uniform mat4 modelView;\n"
"void main()\n"
"{\n"
" gl_Position = projection * modelView * vertexPosition;\n"
" fragColour = vertexColour;\n"
"}\n"

Definition at line 49 of file Native.cpp.

std::vector<GLushort> indices

Definition at line 42 of file Native.cpp.

GLuint modelViewLocation

Definition at line 154 of file Native.cpp.

float modelViewMatrix[16]

Definition at line 157 of file Native.cpp.

GLuint projectionLocation

Definition at line 153 of file Native.cpp.

float projectionMatrix[16]

Definition at line 156 of file Native.cpp.

const struct aiScene* scene = NULL

Definition at line 39 of file Native.cpp.

GLuint vertexColourLocation

Definition at line 152 of file Native.cpp.

GLuint vertexLocation

Definition at line 151 of file Native.cpp.

std::vector<GLfloat> vertices

Definition at line 41 of file Native.cpp.