Hi,

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

Code :
  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" (http://www.khronos.org/opengles/sdk/docs/man/).

So for the reading I coded:
Code :
         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.