Results 1 to 4 of 4

Thread: color transformations - problem with alpha

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    3

    color transformations - problem with alpha

    Hello all,

    using this code snippet:

    VGPath rect;
    VGPaint green;
    VGfloat alphaValues[] = { 1.0, 1.0, 1.0, 0.3, 0.0, 0.0, 0.0, 0.0 };
    green = vgCreatePaint();
    vgSetColor(green, 0x00FF00FF);
    vgSetPaint(green, VG_FILL_PATH | VG_STROKE_PATH);
    vgSetfv(VG_COLOR_TRANSFORM_VALUES, 8, alphaValues);
    vgSeti(VG_COLOR_TRANSFORM, VG_TRUE);
    vgDrawPath(rect, VG_FILL_PATH);

    I would like to change the alpha channel of the green color to be 0.3. However it has no effect on alpha.
    I was playing with it and for R,G,B channels the transformations worked.

    EGLConfig Attributes:
    {
    EGL_RED_SIZE, 5,
    EGL_GREEN_SIZE, 6,
    EGL_BLUE_SIZE, 5,
    EGL_ALPHA_SIZE, 0,
    EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
    EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
    EGL_NONE
    }

    Any idea why alpha remains unchanged ??

    Thanks in advance for any comments/suggestions.
    Martin

  2. #2
    Senior Member
    Join Date
    Feb 2006
    Posts
    115

    Re: color transformations - problem with alpha

    Your framebuffer format looks to be RGB565- it has no alpha channel, hence the result of the color transformation is lost once the color is written to the framebuffer.
    When you read back the contents of the framebuffer, you are reading back the contents of the framebuffer and converting them into your destination format (RGBA8888 I'm guessing). The alpha value is always assumed 1 (0xFF) when reading sampling the 565 format.

    Try using a surface format that has an alpha channel.

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    3

    Re: color transformations - problem with alpha

    Thank you for the reply,

    I switched to 8888 RGBA EGL-Pbuffer surface as it is the only surface having some alpha channel which my device supports.
    When OpenVG rendering is done the Pbuffer is mapped to OpenGL ES texture and this is drawn to Window surface (565 RGB).

    However the result is the same as before when rendering directly to Window surface; color transforms happen just for RGB channels while alpha remains unchanged.

    Any idea what's wrong ??

    Thanks in advance for any suggestion.
    Martin

    My surface configs are as follows:
    const int winConfigAttribs[] =
    {
    EGL_RED_SIZE, 5,
    EGL_GREEN_SIZE, 6,
    EGL_BLUE_SIZE, 5,
    EGL_ALPHA_SIZE, 0,
    EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
    EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT|EGL_OPENGL_ES_BIT,
    EGL_NONE
    };
    const int pbConfigAttribs[] =
    {
    EGL_RED_SIZE, 8,
    EGL_GREEN_SIZE, 8,
    EGL_BLUE_SIZE, 8,
    EGL_ALPHA_SIZE, 8,
    EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
    EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT|EGL_OPENGL_ES_BIT,
    EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE,
    EGL_NONE
    };
    int pbSurfaceAttribs[] = {
    EGL_WIDTH, 1024,
    EGL_HEIGHT, 1024,
    EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
    EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
    EGL_NONE
    };

  4. #4
    Junior Member
    Join Date
    Apr 2009
    Posts
    3

    Re: color transformations - problem with alpha

    Hi all,

    it seems that problem is in OpenVG implementation I am using as with reference implementation it works well.

    Martin

Similar Threads

  1. True color display problem.
    By kometes76 in forum OpenGL ES 1.X - fixed function hardware
    Replies: 1
    Last Post: 10-13-2009, 07:41 AM
  2. alpha blending problem
    By 0stress in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 10-06-2006, 09:14 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
  •