I am using OpenGL 2.0 on the android platform (Samsung Galaxy S2).
When I set a value via the GL_fragcolor which is suppose to be a perfect shade of gray, I instead get the green component either a couple above or below the red and blue values when rendering the scene.
" void main() { " +
" vec4 c = texture2D(texture0, tCoord); " +
" c *= vColor; " +
" gl_FragColor = vec4(c.r,c.r,c.r,1); " +
" } ";
As you can see the end result of this routine above should output the same value for each component. (This is a temporary routine to exaggerate the problem of using gray-scale output)
Screen shot taken of the RGB bleeding problem. I don’t have enough points to post a pic here so uploaded it to photobucket…
http://s1267.photobucket.com/albums/jj556/mrpookie99/?action=view¤t=rgb.png
So I don’t know if it is converting the 8bit value to a 565 value or something like that as I can’t find any documentation which can set the output resolution to the screen…
Thanks for any help,
Andrew.
Okay, I now know why this situation occurs…
If you use the default settings with GLSurfaceView it creates a 16 bit deep buffer for the display @ 565 RGB…
To get around this, I changed the default buffer from 16 bits to 32 bits and all is fixed 🙂
http://developer.android.com/reference/android/opengl/GLSurfaceView.html
A quote from the developer guide:
“If no setEGLConfigChooser method is called, then by default the view will choose an RGB_565 surface with a depth buffer depth of at least 16 bits.”
Hope this helps others in future…