47 #include <android/log.h>
49 #include <GLES3/gl3.h>
59 using namespace MaliSDK;
78 "GL_COMPRESSED_R11_EAC",
82 "GL_COMPRESSED_SIGNED_R11_EAC",
86 "GL_COMPRESSED_RG11_EAC",
90 "GL_COMPRESSED_SIGNED_RG11_EAC",
94 "GL_COMPRESSED_RGB8_ETC2",
98 "GL_COMPRESSED_SRGB8_ETC2",
102 "GL_COMPRESSED_RGBA8_ETC2_EAC",
106 "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",
110 "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",
114 "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",
172 "Incorrect value of index of imageArray.");
177 unsigned char* imageData = NULL;
183 ASSERT(imageData != NULL,
"Could not load image data.")
189 int imageWidth = etcHeader.
getWidth();
203 GL_CHECK(glCompressedTexImage2D(GL_TEXTURE_2D,
215 GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
216 GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
217 GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
218 GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
228 GL_CHECK(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
248 GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER,
250 GL_CHECK(glBufferData(GL_ARRAY_BUFFER,
256 GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER,
258 GL_CHECK(glBufferData(GL_ARRAY_BUFFER,
285 GL_CHECK(glActiveTexture(GL_TEXTURE0));
286 GL_CHECK(glBindTexture (GL_TEXTURE_2D,
294 GL_CHECK(glDrawArrays(GL_TRIANGLES, 0, 6));
313 glClearColor(0.1
f, 0.3
f, 0.2
f, 1.0
f);
316 float scaleMultimplier = 0.0f;
328 scaleMultimplier = (
float) height / (
float)
width;
339 GL_CHECK(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
377 Matrix resultMatrix = ortographicMatrix * scaleMatrix;
380 GL_CHECK(glBindBuffer (GL_ARRAY_BUFFER,
390 GL_CHECK(glBindBuffer (GL_ARRAY_BUFFER,
419 glClear(GL_COLOR_BUFFER_BIT);
472 JNIEnv * env, jobject obj, jint
width, jint
height)
478 JNIEnv * env, jobject obj)
485 JNIEnv * env, jobject obj)
static void loadPKMData(const char *filename, ETCHeader *etcHeader, unsigned char **textureData)
Load header and texture data from a pkm file into memory.
float getTime()
Returns the time passed since object creation or since reset() was last called.
Functions for drawing text in OpenGL ES.
#define TEXTURE_GL_COMPRESSED_RGB8_ETC2_FILE_NAME
GLint GLsizei GLsizei height
#define TEXTURE_GL_COMPRESSED_RG11_EAC_FILE_NAME
#define TEXTURE_GL_COMPRESSED_RGBA8_ETC2_EAC_FILE_NAME
GLint textureCoordinateLocation
#define FONT_VERTEX_SHADER_FILE_NAME
#define FONT_FRAGMENT_SHADER_FILE_NAME
Functions for manipulating matrices.
#define TEXTURE_GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2_FILE_NAME
void initializeTexture(int textureIndex)
Provides a platform independent high resolution timer.
void clear(void)
Removes the current string from the class.
static Matrix matrixOrthographic(float left, float right, float bottom, float top, float zNear, float zFar)
Create and return an orthographic projection matrix.
#define FONT_TEXTURE_FILE_NAME
static Matrix createScaling(float x, float y, float z)
Create and return a scaling matrix.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcTexture_NativeLibrary_uninit(JNIEnv *env, jobject obj)
float * getAsArray(void)
Get the matrix elements as a column major order array.
#define VERTEX_SHADER_FILE_NAME
#define TEXTURE_GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC_FILE_NAME
const float displayInterval
#define TEXTURE_GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2_FILE_NAME
void reset()
Resets the timer to 0.0f.
char * nameOfImageIneternalformat
void uninit()
Delete created objects and free allocated memory.
const int numberOfTextures
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.
#define FRAGMENT_SHADER_FILE_NAME
GLint GLenum internalformat
#define TEXTURE_GL_COMPRESSED_SIGNED_R11_EAC_FILE_NAME
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcTexture_NativeLibrary_step(JNIEnv *env, jobject obj)
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_etcTexture_NativeLibrary_init(JNIEnv *env, jobject obj, jint width, jint height)
#define TEXTURE_GL_COMPRESSED_SIGNED_RG11_EAC_FILE_NAME
GLuint bufferObjectIds[numberOfBufferObjectIds]
Text * internalformatTextDisplayer
GLint modelViewMatrixLocation
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei imageSize
#define TEXTURE_GL_COMPRESSED_R11_EAC_FILE_NAME
#define TEXTURE_GL_COMPRESSED_SRGB8_ETC2_FILE_NAME
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
static void processShader(GLuint *shader, const char *filename, GLint shaderType)
Create shader, load in source, compile, and dump debug as necessary.
float textureCoordinatesData[]
void draw(void)
Draw the text to the screen.
typedef GLuint(GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count