35 #include <GLES2/gl2.h>
36 #include <GLES2/gl2ext.h>
42 #include <android/log.h>
49 using std::stringstream;
51 using namespace MaliSDK;
53 string resourceDirectory =
"/data/data/com.arm.malideveloper.openglessdk.etccompressedalpha/";
77 LOGD(
"setupGraphics(%d, %d)", w, h);
88 LOGE(
"ETC1 not supported");
95 GL_CHECK(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
99 GL_CHECK(glActiveTexture(GL_TEXTURE1));
111 LOGE(
"Could not create program.");
123 LOGE(
"Error: Attribute not found: \"a_v4Position\"");
132 LOGD(
"Warning: Attribute not found: \"a_v2TexCoord\"");
143 LOGD(
"Warning: Uniform not found: \"u_s2dTexture\"");
154 LOGE(
"Uniform not found at line %i\n", __LINE__);
168 GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
184 GL_CHECK(glDrawElements(GL_TRIANGLE_STRIP,
sizeof(
indices) /
sizeof(GLubyte), GL_UNSIGNED_BYTE,
indices));
199 int numberOfImages = 9;
200 for(
int allImages = 0; allImages < numberOfImages; allImages++)
202 stringstream imageNumber;
203 imageNumber << allImages;
204 texturePathFull.replace(
textureFilename.length(), 1, imageNumber.str());
214 (JNIEnv *env, jclass jcls)
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etccompressedalpha_ETCCompressedAlpha_step(JNIEnv *env, jclass jcls)
GLint GLsizei GLsizei height
bool setupGraphics(int w, int h)
string fragmentShaderFilename
GLfloat GLfloat GLfloat w
GLsizei GLenum const void * indices
static void loadCompressedMipmaps(const char *filenameBase, const char *filenameSuffix, GLuint *textureID)
Load compressed mipmaps into memory.
GLfloat GLfloat GLfloat GLfloat h
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etccompressedalpha_ETCCompressedAlpha_uninit(JNIEnv *, jclass)
string vertexShaderFilename
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etccompressedalpha_ETCCompressedAlpha_init(JNIEnv *env, jclass jcls, jint width, jint height)
static bool isETCSupported(bool verbose=false)
Reports whether or not ETC (Ericsson Texture Compression) is supported.
static void processShader(GLuint *shader, const char *filename, GLint shaderType)
Create shader, load in source, compile, and dump debug as necessary.
typedef GLuint(GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count
static const GLfloat textureCoordinates[]