I found out that drawing to the FrameBuffer does not invert the Y but loading a bitmap to opengl does.
These were my texture vertices:
public final static float textureVertices[] = {
0.0f, 1.0f, // top left
0.0f, 0.0f, // bot left
1.0f, 1.0f, // top right
1.0f, 0.0f, // bot right
};
But those are already inverted to account for the inverted bitmap, i thought this was normal, but normal for opengl is this:
public final static float textureVertices[] = {
0.0f, 0.0f, // bot left
0.0f, 1.0f, // top left
1.0f, 0.0f, // bot right
1.0f, 1.0f, // top right
};
So if i create a texture from a bitmap like this:
public static int loadGLTexture(Bitmap bmp) { // also destroys bitmap
int id[] = new int[1];
id[0] = -1;
GLES20.glGenTextures(1, id, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, id[0]);
// Set Filters
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bmp, 0); // upload the texture to OpenGL
bmp.recycle();
return id[0];
}
The texture will have inverted Y, but if i create an empty texture with opengl and draw on it using a FrameBuffer, the Y will not be inverted.