Results 1 to 3 of 3

Thread: FBO's and ES 2

  1. #1
    Junior Member
    Join Date
    Sep 2007
    Posts
    10

    FBO's and ES 2

    Thanks Xmas for you feedback. I will in the future put SDK specific questions to the correct address.

    When working with OpenGL | ES 2.0 I want to render to a texture but get's framebuffer incomplete, incomplete attachment.

    Code :
     
    // Setup FBO texture
    glGenTextures(1, &settings->fboTexture);
    glBindTexture(GL_TEXTURE_2D, settings->fboTexture);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     
    // Generate FBO
    glGenFramebuffers(1, &settings->fbo);
     
    // bind the framebuffer
    glBindFramebuffer(GL_FRAMEBUFFER, settings->fbo);
     
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, settings->fboTexture, 0);
    checkFramebufferStatus();
     
    // run shader program
    drawQuad(512, 512, 512, 512, program1);
     
    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    Must I have a render buffer attached? Can't i render direct to a texture?

    best regards,
    Fredrik

  2. #2
    Junior Member
    Join Date
    Sep 2007
    Posts
    10

    problem solved..

    Forgot a line of code...
    Code :
    	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, settings->width, settings->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

    best regards,
    Fredrik

  3. #3
    Senior Member
    Join Date
    May 2006
    Posts
    353
    What graphics card and drivers are you using? What's the size of the texture?

    Note that the texture should be unbound/not used in the shader while you render to it, otherwise the results are undefined.
    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

Similar Threads

  1. glReadPixels while using FBO
    By inhosens in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 07-04-2008, 02:40 AM
  2. problems using FBO's in ES 2
    By freber in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 10-08-2007, 10:19 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
  •