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>

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 w, int h)
 
void renderFrame ()
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_simpletriangle_NativeLibrary_init (JNIEnv *env, jobject obj, jint width, jint height)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_simpletriangle_NativeLibrary_step (JNIEnv *env, jobject obj)
 

Variables

static const char glVertexShader []
 
static const char glFragmentShader []
 
GLuint simpleTriangleProgram
 
GLuint vPosition
 
const GLfloat triangleVertices []
 

Macro Definition Documentation

#define LOG_TAG   "libNative"

Definition at line 32 of file Native.cpp.

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

Definition at line 34 of file Native.cpp.

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

Definition at line 33 of file Native.cpp.

Function Documentation

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

Definition at line 94 of file Native.cpp.

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

Definition at line 195 of file Native.cpp.

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

Definition at line 201 of file Native.cpp.

GLuint loadShader ( GLenum  shaderType,
const char *  shaderSource 
)

Definition at line 56 of file Native.cpp.

void renderFrame ( void  )

Definition at line 175 of file Native.cpp.

bool setupGraphics ( int  w,
int  h 
)

Definition at line 150 of file Native.cpp.

Variable Documentation

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

Definition at line 47 of file Native.cpp.

const char glVertexShader[]
static
Initial value:
=
"attribute vec4 vPosition;\n"
"void main()\n"
"{\n"
" gl_Position = vPosition;\n"
"}\n"

Definition at line 38 of file Native.cpp.

GLuint simpleTriangleProgram

Definition at line 147 of file Native.cpp.

const GLfloat triangleVertices[]
Initial value:
= {
0.0f, 1.0f,
-1.0f, -1.0f,
1.0f, -1.0f
}

Definition at line 169 of file Native.cpp.

GLuint vPosition

Definition at line 148 of file Native.cpp.