ReadPixels from Framebuffer Object (fbo) => wrong Colors?

Hi,

for selection I´m using the color picking method, the rendering etc. is working fine but I get the wrong colors.


  var back_colors = [
    // Front face
    224/255, 0.0, 0.0, 255/255,
    224/255, 0.0, 0.0, 255/255,
    224/255, 0.0, 0.0, 255/255,

    222/255, 0.0, 0.0, 255/255,
    222/255, 0.0, 0.0, 255/255,
    222/255, 0.0, 0.0, 255/255,

    222/255, 0.0, 0.0, 255/255,
    222/255, 0.0, 0.0, 255/255,
    222/255, 0.0, 0.0, 255/255,

    222/255, 0.0, 0.0, 255/255,
    222/255, 0.0, 0.0, 255/255,
    222/255, 0.0, 0.0, 255/255
    ];
    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(back_colors), gl.STATIC_DRAW);

So the reference page states regarding “glReadPixels” : “When type is GL_UNSIGNED_BYTE, each component is multiplied by 2^8 -1” (OpenGL ES 2.0 Reference Pages).

So for the reading I coded:


         var element_color = new Uint8Array(gl.viewportWidth * gl.viewportHeight * 4); 
         gl.readPixels(window_x, window_y, gl.viewportWidth, gl.viewportHeight, gl.RGBA, gl.UNSIGNED_BYTE, element_color);

So for Red I would expect a value of 224 or 222 but what I get is 221.

Whats going on?

Greetings S.

The Problem lies within “Minefield”, when I build with Webkit the error is gone and I get the expected colors.