Results 1 to 2 of 2

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

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    7

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

    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.

  2. #2
    Junior Member
    Join Date
    Sep 2010
    Posts
    7

    Re: ReadPixels from Framebuffer Object (fbo) => wrong Colors

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

Similar Threads

  1. can framebuffer object used without egl initialization?
    By qzhua in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 6
    Last Post: 05-22-2012, 11:40 AM
  2. readPixels on framebuffer problem
    By Jens1 in forum Developers Coding:Beginner
    Replies: 2
    Last Post: 01-28-2012, 08:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •