35 #include <GLES2/gl2.h>
36 #include <GLES2/gl2ext.h>
42 #include <android/log.h>
47 #include "ETCHeader.h"
50 using std::stringstream;
52 using namespace MaliSDK;
71 LOGD(
"setupGraphics(%d, %d)", width, height);
82 LOGE(
"ETC1 not supported");
89 GL_CHECK(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
98 LOGD(
"vertexShaderID = %d", vertexShaderID);
100 LOGD(
"fragmentShaderID = %d", fragmentShaderID);
105 LOGE(
"Could not create program.");
117 LOGE(
"Attribute not found: \"a_v4Position\"");
126 LOGD(
"Warning: Attribute not found: \"a_v2TexCoord\"");
137 LOGD(
"Warning: Uniform not found: \"u_s2dTexture\"");
152 GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
168 GL_CHECK(glDrawElements(GL_TRIANGLE_STRIP,
sizeof(
indices) /
sizeof(GLubyte), GL_UNSIGNED_BYTE,
indices));
182 int numberOfImages = 9;
183 for(
int allImages = 0; allImages < numberOfImages; allImages++)
185 stringstream imageNumber;
186 imageNumber << allImages;
187 texturePathFull.replace(
textureFilename.length(), 1, imageNumber.str());
195 (JNIEnv *env, jclass jcls)
GLint GLsizei GLsizei height
GLsizei GLenum const void * indices
static void loadCompressedMipmaps(const char *filenameBase, const char *filenameSuffix, GLuint *textureID)
Load compressed mipmaps into memory.
bool setupGraphics(int width, int height)
string fragmentShaderFilename
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcatlasalpha_ETCAtlasAlpha_uninit(JNIEnv *, jclass)
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcatlasalpha_ETCAtlasAlpha_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.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcatlasalpha_ETCAtlasAlpha_step(JNIEnv *env, jclass jcls)
typedef GLuint(GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count
static const GLfloat textureCoordinates[]
string vertexShaderFilename