OpenGL changes in Android 4.2

Started by K24A3, December 04, 2012, 12:57:50 AM

Previous topic - Next topic

K24A3

This is a general OpenGL question not directly related to jPCT but I would like to ask if anyone here is aware of any OpenGL ES1.x changes in Android 4.2 (JellyBean MR1)?

@Egon, did you need to make any modifications for Jellybean compatibility?

I have an app that uses pure OpenGL ES1.1 and the textures are all messed up on multiple 4.2 devices plus the emulator. If I load 5 textures, the last texture loaded is used for all 5 textures, but if I load only 2 textures, those 2 textures render fine. The texture clipping is also not working properly. The whole texture is rendered instead of the clipping region.

I create the textures by:

int[] textures = new int[5];
gl.glGenTextures(5, textures, 0);

Then load an image resource into a byteBuffer and upload it to the GPU:

gl.glBindTexture(GL11.GL_TEXTURE_2D, textures[n])
gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_LINEAR)     
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR)
gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, 512, 512,0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, byteBuffer) 

Drawing:

textureCrop0[0] = 0// Left
textureCrop0[1] = 0 // Bottom
textureCrop0[2] = 512// Width
textureCrop0[3] = 512 // Height
gl.glTexParameteriv(GL11.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, textureCrop0, 0)


Were any of these functions changed in 4.2?
            

EgonOlsen

None that i'm aware of. jPCT-AE works just fine on 4.2 and 4.2.1 on my Nexus 7.

K24A3

Finally found the problem, I was loading the image pixels manually pixel by pixel and using a temporary buffer to hold the pixels. Even though I made sure I was freeing and nulling the buffer after each image load, I'm guessing Android was garbage collecting the buffer at some stage causing blank or disordered textures despite using allocateDirect to avoid the GC...

Anyway I use the GLUtil texImage2D now and all is fine. Seems like Google fiddled around with the GC again in 4.2 :p