A pain to get my buffer work

I once posted a thread about the depth texture problem, and added more and more questions there. Now I summarize my current problems here and hope somebody can give me a hand.

first, to get my Render Buffer work. The code for initialization is as simple as:


glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);

glGenRenderbuffers(1, &rbo);
glBindRenderbuffer(GL_RENDERBUFFER, rbo);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB, 512, 512);

glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);

glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);

Then in the glutDisplayFunc(), I called


glBindFramebuffer(GL_DRAW_FRAMEBUFFER, rbo);

before rendering, and called


glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);

after.
The program runs well before I use framebuffer object, only after binding the framebuffer object, I find nothing in the render buffer object.

This problem has bothered me for two days…

You should be using fbo instead of rbo when binding frame buffer:


glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);

http://www.songho.ca/opengl/gl_fbo.html has a nice clear FBO tutorial (as well as other clear tutorials)

Have you also checked the framebuffer status:


GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
  fboUsed = false;

Thank you very much.

It turns out that it was this typo that wasted me almost a whole day.