OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ETCCompressedAlpha.cpp File Reference

A sample to show how to use textures with an seperate compressed image for alpha. More...

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <string>
#include <sstream>
#include <jni.h>
#include <android/log.h>
#include "ETCCompressedAlpha.h"
#include "Shader.h"
#include "Texture.h"
#include "AndroidPlatform.h"

Go to the source code of this file.

Functions

bool setupGraphics (int w, int h)
 
void renderFrame (void)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etccompressedalpha_ETCCompressedAlpha_init (JNIEnv *env, jclass jcls, jint width, jint height)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etccompressedalpha_ETCCompressedAlpha_step (JNIEnv *env, jclass jcls)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etccompressedalpha_ETCCompressedAlpha_uninit (JNIEnv *, jclass)
 

Variables

string resourceDirectory = "/data/data/com.arm.malideveloper.openglessdk.etccompressedalpha/"
 
string textureFilename = "good_compressed_mip_"
 
string imageExtension = ".pkm"
 
string alphaExtension = "_alpha.pkm"
 
string vertexShaderFilename = "ETCCompressedAlpha_dualtex.vert"
 
string fragmentShaderFilename = "ETCCompressedAlpha_dualtex.frag"
 
GLuint textureID = 0
 
GLuint alphaTextureID = 0
 
GLuint vertexShaderID = 0
 
GLuint fragmentShaderID = 0
 
GLuint programID = 0
 
GLint iLocPosition = -1
 
GLint iLocTexCoord = -1
 
GLint iLocSampler = -1
 
GLint iLocAlphaSampler = -1
 

Detailed Description

A sample to show how to use textures with an seperate compressed image for alpha.

ETC does not support alpha channels directly. Here we use a texture which orginally contained an alpha channel but was compressed using the Mali Texture Compression Tool using the "Create seperate compressed image" option for alpha handling. This makes an ETC compressed image for the RGB channels and a seperate compressed image for the Alpha channel. In this sample both images are loaded and the RGB and Alpha components are merged back together in the fragment shader.

Definition in file ETCCompressedAlpha.cpp.

Function Documentation

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etccompressedalpha_ETCCompressedAlpha_init ( JNIEnv *  env,
jclass  jcls,
jint  width,
jint  height 
)

Definition at line 190 of file ETCCompressedAlpha.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etccompressedalpha_ETCCompressedAlpha_step ( JNIEnv *  env,
jclass  jcls 
)

Definition at line 214 of file ETCCompressedAlpha.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etccompressedalpha_ETCCompressedAlpha_uninit ( JNIEnv *  ,
jclass   
)

Definition at line 220 of file ETCCompressedAlpha.cpp.

void renderFrame ( void  )

Definition at line 166 of file ETCCompressedAlpha.cpp.

bool setupGraphics ( int  w,
int  h 
)

Definition at line 75 of file ETCCompressedAlpha.cpp.

Variable Documentation

string alphaExtension = "_alpha.pkm"

Definition at line 56 of file ETCCompressedAlpha.cpp.

GLuint alphaTextureID = 0

Definition at line 63 of file ETCCompressedAlpha.cpp.

string fragmentShaderFilename = "ETCCompressedAlpha_dualtex.frag"

Definition at line 59 of file ETCCompressedAlpha.cpp.

GLuint fragmentShaderID = 0

Definition at line 67 of file ETCCompressedAlpha.cpp.

GLint iLocAlphaSampler = -1

Definition at line 73 of file ETCCompressedAlpha.cpp.

GLint iLocPosition = -1

Definition at line 69 of file ETCCompressedAlpha.cpp.

GLint iLocSampler = -1

Definition at line 71 of file ETCCompressedAlpha.cpp.

GLint iLocTexCoord = -1

Definition at line 70 of file ETCCompressedAlpha.cpp.

string imageExtension = ".pkm"

Definition at line 55 of file ETCCompressedAlpha.cpp.

GLuint programID = 0

Definition at line 68 of file ETCCompressedAlpha.cpp.

string resourceDirectory = "/data/data/com.arm.malideveloper.openglessdk.etccompressedalpha/"

Definition at line 53 of file ETCCompressedAlpha.cpp.

string textureFilename = "good_compressed_mip_"

Definition at line 54 of file ETCCompressedAlpha.cpp.

GLuint textureID = 0

Definition at line 62 of file ETCCompressedAlpha.cpp.

string vertexShaderFilename = "ETCCompressedAlpha_dualtex.vert"

Definition at line 58 of file ETCCompressedAlpha.cpp.

GLuint vertexShaderID = 0

Definition at line 66 of file ETCCompressedAlpha.cpp.