Results 1 to 3 of 3

Thread: Problem with render to texture using pbuffer and alpha

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Posts
    2

    Problem with render to texture using pbuffer and alpha

    I'm using pbuffer for rendering to texture. In the final texture I want a black/transparent background, as parts of it should be transparent.Rendering things into the texture works fine, and I can display it using 2 triangles. The problem is that the parts which hasn't been rendered to are supposed to be transparent, but they are displayed as black (which I cleared it to, but the alpha seems to be ignored).

    I'm creating the config whith these params:

    Code :
        EGLint pi32ConfigAttribs[] = {
    		EGL_CONFIG_CAVEAT, EGL_NONE,
            EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
            EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE,
            EGL_NONE
        };
     
        int iConfigs;
        eglChooseConfig(y_gles_config.display,
                        pi32ConfigAttribs,
                        &y_gles_config.config,
                        1,
                        &iConfigs);

    then I create the pBuffer with this:
    Code :
                         EGLint attribs[] = { EGL_WIDTH, fTexWidth,
            					 EGL_HEIGHT, fTexHeight,
            					 EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
            					 EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
            					 EGL_NONE};
     
    		fEglSurface = eglCreatePbufferSurface(y_gles_config.display,
    								y_gles_config.config,
    								attribs);

    then I create the texture with this:
    Code :
                    glGenTextures(1, &fTexId);
    		glBindTexture(GL_TEXTURE_2D, fTexId);
     
    		y_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    		y_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    		y_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    		y_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     
    		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fTexWidth, fTexHeight, 0, GL_RGBA,  GL_UNSIGNED_BYTE, 0);

    I use rgba for all texture formats.

    I then set up the rendertarget with makeCurrent, set up viewport etc and clear it with:
    Code :
        y_glClearColor(yGLreal(0), yGLreal(0), yGLreal(0), yGLreal(0));
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    I also enable blending, and set up the blendingfunction before rendering the 2 triangles with the final texture, so I think the problem is in the texture/surface. I searched on google and it seems that under regular GL, one must use GLUT_RGBA on glutInitialize to get alpha on framebuffers, but haven't found any similar options for GL ES 1.1. Any one got any tips ?

  2. #2
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: Problem with render to texture using pbuffer and alpha

    The glTexImage2D call is unnecessary since the pbuffer provides its own storage anyway when it's bound to the texture object. You might try requesting a config with at least one alpha bit, i.e. add (EGL_ALPHA_SIZE, 1) to pi32ConfigAttribs.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  3. #3
    Junior Member
    Join Date
    Jan 2009
    Posts
    2

    Re: Problem with render to texture using pbuffer and alpha

    Thanks for responding. I've tried egl_alpha_size 1 and 8 and it still looks the same.

Similar Threads

  1. Multitexturing && Texture With Alpha Channel problem....
    By Rubbio in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 04-20-2009, 06:51 AM
  2. Render to texture or pBuffer on Intel 2700G
    By ii7017 in forum OpenGL ES general technical discussions
    Replies: 3
    Last Post: 09-08-2006, 02: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
  •