23 #include <android/log.h>
25 #include <GLES2/gl2.h>
46 for (error = glGetError(); error != GL_NO_ERROR; error = glGetError())
48 LOGE(
"glError (0x%x) after `%s` \n", error, operation);
64 return "GL_INVALID_ENUM";
66 case GL_INVALID_VALUE:
67 return "GL_INVALID_VALUE";
69 case GL_INVALID_OPERATION:
70 return "GL_INVALID_OPERATION";
72 case GL_OUT_OF_MEMORY:
73 return "GL_OUT_OF_MEMORY";
75 case GL_INVALID_FRAMEBUFFER_OPERATION:
76 return "GL_INVALID_FRAMEBUFFER_OPERATION";
87 char *newString = NULL;
92 length = strlen(
string) + 1;
93 newString = (
char*)malloc(length);
94 if (newString == NULL)
96 LOGE(
"copyString(): Failed to allocate memory using malloc().\n");
99 memcpy(newString,
string, length);
105 if (JNIEnvironment == NULL || destinationDirectory == NULL || filename == NULL)
107 LOGE(
"getAndroidAsset(): NULL argument is not acceptable.\n");
112 string resourceFilePath = string(destinationDirectory) + string(filename);
116 file = fopen(resourceFilePath.c_str(),
"r");
130 JavaClass javaClass(JNIEnvironment,
"com/arm/malideveloper/openglessdk/MaliSamplesActivity");
133 if (!javaClass.
staticMethod(
"extractAsset", destinationDirectory, filename))
135 LOGE(
"getAndroidAsset(): Failed to call MaliSamplesActivity.extractAsset() for %s\n", filename);
Wraps a Java class to allow access to it's static fields and methods using JNI.
GLenum GLuint GLenum GLsizei length
bool staticMethod(const char *methodName, int **returnValue, const char *param01)
Call a static method with one parameter which returns an integer array within the Java class...