OpenGL ES SDK for Android
ARM Developer Center
|
A sample to show how to use textures with an seperate uncompressed image for alpha. More...
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <string>
#include <sstream>
#include <jni.h>
#include <android/log.h>
#include "ETCUncompressedAlpha.h"
#include "Shader.h"
#include "Texture.h"
#include "AndroidPlatform.h"
Go to the source code of this file.
Functions | |
int | loadUncompressedAlpha (const char *filename, GLuint *textureID) |
bool | setupGraphics (int w, int h) |
void | renderFrame (void) |
JNIEXPORT void JNICALL | Java_com_arm_malideveloper_openglessdk_etcuncompressedalpha_ETCUncompressedAlpha_init (JNIEnv *env, jclass jcls, jint width, jint height) |
JNIEXPORT void JNICALL | Java_com_arm_malideveloper_openglessdk_etcuncompressedalpha_ETCUncompressedAlpha_step (JNIEnv *env, jclass jcls) |
JNIEXPORT void JNICALL | Java_com_arm_malideveloper_openglessdk_etcuncompressedalpha_ETCUncompressedAlpha_uninit (JNIEnv *, jclass) |
Variables | |
string | resourceDirectory = "/data/data/com.arm.malideveloper.openglessdk.etcuncompressedalpha/" |
string | textureFilename = "good_uncompressed_mip_" |
string | imageExtension = ".pkm" |
string | alphaExtension = "_alpha.pgm" |
string | vertexShaderFilename = "ETCUncompressedAlpha_dualtex.vert" |
string | fragmentShaderFilename = "ETCUncompressedAlpha_dualtex.frag" |
GLuint | textureID = 0 |
GLuint | alphaTextureID = 0 |
GLuint | programID = 0 |
GLint | iLocPosition = -1 |
GLint | iLocTexCoord = -1 |
GLint | iLocSampler = -1 |
GLint | iLocAlphaSampler = -1 |
A sample to show how to use textures with an seperate uncompressed 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 uncompressed image" option for alpha handling. This makes an ETC compressed image for the RGB channels and a seperate uncompressed 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 ETCUncompressedAlpha.cpp.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcuncompressedalpha_ETCUncompressedAlpha_init | ( | JNIEnv * | env, |
jclass | jcls, | ||
jint | width, | ||
jint | height | ||
) |
Definition at line 243 of file ETCUncompressedAlpha.cpp.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcuncompressedalpha_ETCUncompressedAlpha_step | ( | JNIEnv * | env, |
jclass | jcls | ||
) |
Definition at line 266 of file ETCUncompressedAlpha.cpp.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcuncompressedalpha_ETCUncompressedAlpha_uninit | ( | JNIEnv * | , |
jclass | |||
) |
Definition at line 272 of file ETCUncompressedAlpha.cpp.
Definition at line 79 of file ETCUncompressedAlpha.cpp.
Definition at line 219 of file ETCUncompressedAlpha.cpp.
Definition at line 126 of file ETCUncompressedAlpha.cpp.
string alphaExtension = "_alpha.pgm" |
Definition at line 56 of file ETCUncompressedAlpha.cpp.
GLuint alphaTextureID = 0 |
Definition at line 63 of file ETCUncompressedAlpha.cpp.
string fragmentShaderFilename = "ETCUncompressedAlpha_dualtex.frag" |
Definition at line 59 of file ETCUncompressedAlpha.cpp.
GLint iLocAlphaSampler = -1 |
Definition at line 70 of file ETCUncompressedAlpha.cpp.
GLint iLocPosition = -1 |
Definition at line 67 of file ETCUncompressedAlpha.cpp.
GLint iLocSampler = -1 |
Definition at line 69 of file ETCUncompressedAlpha.cpp.
GLint iLocTexCoord = -1 |
Definition at line 68 of file ETCUncompressedAlpha.cpp.
string imageExtension = ".pkm" |
Definition at line 55 of file ETCUncompressedAlpha.cpp.
GLuint programID = 0 |
Definition at line 66 of file ETCUncompressedAlpha.cpp.
string resourceDirectory = "/data/data/com.arm.malideveloper.openglessdk.etcuncompressedalpha/" |
Definition at line 53 of file ETCUncompressedAlpha.cpp.
string textureFilename = "good_uncompressed_mip_" |
Definition at line 54 of file ETCUncompressedAlpha.cpp.
GLuint textureID = 0 |
Definition at line 62 of file ETCUncompressedAlpha.cpp.
string vertexShaderFilename = "ETCUncompressedAlpha_dualtex.vert" |
Definition at line 58 of file ETCUncompressedAlpha.cpp.