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

A sample to show how to use textures with the alpha channel as part of the texture atlas. More...

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

Go to the source code of this file.

Functions

bool setupGraphics (int width, int height)
 
void renderFrame (void)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcatlasalpha_ETCAtlasAlpha_init (JNIEnv *env, jclass jcls, jint width, jint height)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcatlasalpha_ETCAtlasAlpha_step (JNIEnv *env, jclass jcls)
 
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcatlasalpha_ETCAtlasAlpha_uninit (JNIEnv *, jclass)
 

Variables

string resourceDirectory = "/data/data/com.arm.malideveloper.openglessdk.etcatlasalpha/"
 
string textureFilename = "good_atlas_mip_"
 
string imageExtension = ".pkm"
 
string vertexShaderFilename = "ETCAtlasAlpha_atlastex.vert"
 
string fragmentShaderFilename = "ETCAtlasAlpha_atlastex.frag"
 
GLuint textureID = 0
 
GLuint programID = 0
 
GLint iLocPosition = -1
 
GLint iLocTexCoord = -1
 
GLint iLocSampler = -1
 

Detailed Description

A sample to show how to use textures with the alpha channel as part of the texture atlas.

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 atlas" option for alpha handling. This makes an ETC compressed image containing both the RGB and alpha channels. However, the alpha channel is stored below the RGB image forming a texture atlas. In this sample the atlas images are loaded and the RGB and Alpha components are merged back together in the fragment shader.

Definition in file ETCAtlasAlpha.cpp.

Function Documentation

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

Definition at line 174 of file ETCAtlasAlpha.cpp.

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

Definition at line 195 of file ETCAtlasAlpha.cpp.

JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcatlasalpha_ETCAtlasAlpha_uninit ( JNIEnv *  ,
jclass   
)

Definition at line 201 of file ETCAtlasAlpha.cpp.

void renderFrame ( void  )

Definition at line 150 of file ETCAtlasAlpha.cpp.

bool setupGraphics ( int  width,
int  height 
)

Definition at line 69 of file ETCAtlasAlpha.cpp.

Variable Documentation

string fragmentShaderFilename = "ETCAtlasAlpha_atlastex.frag"

Definition at line 58 of file ETCAtlasAlpha.cpp.

GLint iLocPosition = -1

Definition at line 65 of file ETCAtlasAlpha.cpp.

GLint iLocSampler = -1

Definition at line 67 of file ETCAtlasAlpha.cpp.

GLint iLocTexCoord = -1

Definition at line 66 of file ETCAtlasAlpha.cpp.

string imageExtension = ".pkm"

Definition at line 55 of file ETCAtlasAlpha.cpp.

GLuint programID = 0

Definition at line 64 of file ETCAtlasAlpha.cpp.

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

Definition at line 53 of file ETCAtlasAlpha.cpp.

string textureFilename = "good_atlas_mip_"

Definition at line 54 of file ETCAtlasAlpha.cpp.

GLuint textureID = 0

Definition at line 61 of file ETCAtlasAlpha.cpp.

string vertexShaderFilename = "ETCAtlasAlpha_atlastex.vert"

Definition at line 57 of file ETCAtlasAlpha.cpp.