   FBO and reading with glReadPixels
  Hello everyone,I want to render a scene larger that the screen size, if I got itcorrectly (source: http://www.songho.ca/opengl/gl_fbo.html), I shoulduse FBO because the default framebuffer called window-system-providedwill be controlled and I won't be able to render a scene larger thanthe screen resolution.I'm sort of confused, I can't get the code work, here is part of thecode:myProjection.initOpenGL(inputImage->width , inputImage->height);// initOpenGL is for glutInitWindowSize(), glViewport(), andgluPerspective()//(If my image width and height are larger than my screen resolution, the program without //FBO crash)    glGenFramebuffersEXT(1, &fboId);    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);    glGenRenderbuffersEXT(1, &rboId);    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rboId);    glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,windowWidth, windowHeight);//    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);    // attach a texture to FBO color attachement point//    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, textureId, 0);    // attach a renderbuffer to depth attachment point    glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rboId);// I the beginning of the drawScene() I addglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);// then I draw the scene, which contains a loaded 3D model withtexture// at the end of the drawing scene, I add//  back to normal window-system-provided framebuffer   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // unbind// and after that, I want to read the render scene to OpenCVvoid Projection::OpenGL2OpenCV(IplImage * imgO){// source: http://webeng.cs.ait.ac.th/cvwiki/gltocv:main   int width = imgO->width;   int height = imgO->height;...   IplImage *img = cvCreateImage(cvSize(width,height),IPL_DEPTH_8U,3);glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE,imageData);...}I can't find where is the problem, it's not working.I don't want to use the render image as texture, I just want to read it after the rendering, so is it enough to use a renderbuffer even than my scene has a texture?I also check for errors in FBO generation, I render my scene twice, the first time I get an error "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT", and the second rendering is fine, it pass the test GL_FRAMEBUFFER_COMPLETE_EXT. Many thanks for any help :)Bye   
  I think you need to tell it where to draw to.  Try putting these two lines after your call to glFramebufferTexture2DEXT:glDrawBuffer(GL_FRONT);glReadBuffer(GL_FRONT);I'm not too sure about the GL_FRONT param - I use FBO's just for a depth render and use GL_NONE...   ;  You have to set the corresponding attachment you want to read when calling glReadPixels to extract the color data from an FBO such as:glDrawBuffer (GL_COLOR_ATTACHMENT0_EXT);Also make sure to call glWindowPos AFTER binding the FBO. Obviously the FBO needs to be bound while reading its color attachment pixels.Note that you can also read pixels from the texture itself using glGetTexImage instead of glReadPixels. You already have the FBO texture and can just keep the FBO unbound and then bind its texture as GL texture and read its content. Finally, find out why you get an FBO setup error and fix this before proceeding any further.