34 #undef DISABLE_MIPMAPS
36 #include <GLES2/gl2.h>
37 #include <GLES2/gl2ext.h>
43 #include <android/log.h>
49 #include "ETCHeader.h"
52 using std::stringstream;
54 using namespace MaliSDK;
79 LOGD(
"setupGraphics(%d, %d)", w, h);
92 GL_CHECK(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
97 LOGE(
"ETC1 not supported");
103 text->
addString(0, 0,
"Mipmapped ETC1 compressed texture", 255, 255, 0, 255);
125 loadedETCHeader.getWidth(), loadedETCHeader.getHeight(), 0,
126 loadedETCHeader.getPaddedWidth() * loadedETCHeader.getPaddedHeight() >> 1,
130 # ifdef DISABLE_MIPMAPS
132 GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
135 GL_CHECK(glGenerateMipmap(GL_TEXTURE_2D));
147 LOGE(
"Could not create program.");
159 LOGE(
"Attribute not found: \"a_v4Position\"");
168 LOGD(
"Warning: Attribute not found: \"a_v2TexCoord\"");
179 LOGD(
"Warning: Uniform not found: \"u_s2dTexture\"");
194 GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
210 GL_CHECK(glActiveTexture(GL_TEXTURE0));
213 GL_CHECK(glDrawElements(GL_TRIANGLE_STRIP,
sizeof(
indices) /
sizeof(GLubyte), GL_UNSIGNED_BYTE,
indices));
230 int numberOfImages = 9;
231 for(
int allImages = 0; allImages < numberOfImages; allImages++)
233 stringstream imageNumber;
234 imageNumber << allImages;
235 texturePathFull.replace(
textureFilename.length(), 1, imageNumber.str());
243 (JNIEnv *env, jclass jcls)
string fragmentShaderFilename
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcmipmap_ETCMipmap_uninit(JNIEnv *, jclass)
Functions for drawing text in OpenGL ES.
GLint GLsizei GLsizei height
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.
string vertexShaderFilename
void addString(int xPosition, int yPosition, const char *string, int red, int green, int blue, int alpha)
Add a std::string to be drawn to the screen.
GLfloat GLfloat GLfloat GLfloat h
bool setupGraphics(int w, int h)
unsigned char * textureData
static void loadData(const char *filename, unsigned char **textureData)
Load texture data from a file into memory.
static bool isETCSupported(bool verbose=false)
Reports whether or not ETC (Ericsson Texture Compression) is supported.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcmipmap_ETCMipmap_step(JNIEnv *env, jclass jcls)
static void processShader(GLuint *shader, const char *filename, GLint shaderType)
Create shader, load in source, compile, and dump debug as necessary.
void draw(void)
Draw the text to the screen.
typedef GLuint(GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcmipmap_ETCMipmap_init(JNIEnv *env, jclass jcls, jint width, jint height)
static const GLfloat textureCoordinates[]