Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: rendering fbo to texture, doesn't seem to work

  1. #1
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    2

    rendering fbo to texture, doesn't seem to work

    Hi.

    Code here: http://sprunge.us/aGii

    expected behaviour: texture attached to fbo is filled with red, red square then renders in bottom left 50x50 pixel square. rest of screen remains black

    actual behavior: white square renders in bottom left 50x50 pixel square, rest of screen is red.

    At the moment I'm just trying to get the frame buffer to render anything, although my eventual goal is to render some triangles into it.

    Any help would be appreciated

  2. #2
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    2
    an update: http://sprunge.us/NJCA
    the colors from the two FBOs seem to be being combined, but the wrong way around. I'd expect the red square to be at the bottom left, and the green square to be the rest of the screen. However, it's the opposite way around.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    some changes for you

    1) you must set the clear colour before you clear
    Code :
    glClearColor(0,1,0,1);
    glClear(GL_COLOR_BUFFER_BIT);

    2) you must activate a texture before you bind
    Code :
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, textureId);

Posting Permissions

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