30 #include <GLES2/gl2.h>
31 #include <GLES2/gl2ext.h>
36 #include <android/log.h>
46 using namespace MaliSDK;
49 string resourceDirectory =
"/data/data/com.arm.malideveloper.openglessdk.framebufferobject/";
54 #define FBO_HEIGHT 256
113 GL_CHECK(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
117 text->
addString(0, 0,
"Simple FrameBuffer Object (FBO) Example", 255, 255, 0, 255);
123 GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
124 GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
125 GL_CHECK(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
FBO_WIDTH, FBO_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL));
135 GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
iFBOTex, 0));
138 GLenum iResult =
GL_CHECK(glCheckFramebufferStatus(GL_FRAMEBUFFER));
139 if(iResult != GL_FRAMEBUFFER_COMPLETE)
141 LOGE(
"Framebuffer incomplete at %s:%i\n", __FILE__, __LINE__);
146 GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0));
163 LOGE(
"Attribute not found at %s:%i\n", __FILE__, __LINE__);
172 LOGD(
"Warning: Uniform not found at %s:%i\n", __FILE__, __LINE__);
183 LOGD(
"Warning: Uniform not found at %s:%i\n", __FILE__, __LINE__);
194 LOGD(
"Warning: Attribute not found at %s:%i\n", __FILE__, __LINE__);
205 LOGD(
"Warning: Attribute not found at %s:%i\n", __FILE__, __LINE__);
216 LOGD(
"Warning: Uniform not found at %s:%i\n", __FILE__, __LINE__);
227 LOGD(
"Warning: Uniform not found at %s:%i\n", __FILE__, __LINE__);
265 GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
291 GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER,0));
298 GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
321 GL_CHECK(glActiveTexture(GL_TEXTURE0));
353 (JNIEnv *env, jclass jcls)
GLfloat cubeColors[numberOfValuesInCubeColorsArray]
Functions for drawing text in OpenGL ES.
GLint GLsizei GLsizei height
Functions for manipulating matrices.
static Matrix createTranslation(float x, float y, float z)
Create and return a translation matrix.
string fragmentShaderFilename
static Matrix matrixPerspective(float FOV, float ratio, float zNear, float zFar)
Create and return a perspective projection matrix.
float * getAsArray(void)
Get the matrix elements as a column major order array.
static const float cubeVertices[]
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_framebufferobject_FrameBufferObject_uninit(JNIEnv *, jclass)
static const GLubyte cubeIndices[]
string vertexShaderFilename
bool setupGraphics(int width, int height)
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.
static Matrix createRotationY(float angle)
Create and return a rotation matrix around the y-axis matrix.
static Matrix createRotationZ(float angle)
Create and return a rotation matrix around the z-axis matrix.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_framebufferobject_FrameBufferObject_step(JNIEnv *env, jclass jcls)
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.
static const float cubeTextureCoordinates[]
void draw(void)
Draw the text to the screen.
typedef GLuint(GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count
static Matrix createRotationX(float angle)
Create and return a rotation matrix around the x-axis matrix.
JNIEXPORT void JNICALL Java_com_arm_malideveloper_openglessdk_framebufferobject_FrameBufferObject_init(JNIEnv *env, jclass jcls, jint width, jint height)