|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| OpenGL FrameBuffer Object 101 |
|
![]() MENTAL Member since: 4/8/2000 From: Herne Bay, United Kingdom |
||||
|
|
||||
| Oh My God Rate++++++++++++++++++++++++++++++++++++++++++++++++ |
||||
|
||||
![]() Pipo DeClown Member since: 2/16/2002 From: Amsterdam, Netherlands |
||||
|
|
||||
| You sing very well. Nice voice! |
||||
|
||||
![]() elFarto Member since: 10/21/2006 |
||||
|
|
||||
Quote: Indeed, It was a very clear article. Regards elFarto |
||||
|
||||
![]() iNsAn1tY Member since: 12/18/2001 From: Guildford |
||||
|
|
||||
| Excellent. I've been using FBOs for a while, and I learnt something new :) My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored. [ Useful things - Firefox | GLee | Boost | DevIL ] |
||||
|
||||
![]() Aph3x GDNet+ Member since: 1/7/2004 From: UK |
||||
|
|
||||
| Yep - very nice article - cheers Rob! |
||||
|
||||
![]() cyrfer Member since: 12/9/2006 From: Monterey, CA, United States |
||||
|
|
||||
| Well, my experience with this tutorial was not as good. It reads very well, but the code doesn't work on my machine. So, I'm wondering if I typed up something wrong or if I have a bug in my graphics driver. I've been trying to get past this issue for a while, even before the tutorial came out. It looks like it samples the code available in MOGP text. I liked the part that tells you to add a depth buffer, which wasn't obvious from reading MOGP. I'd like to know if anyone typed up this code and saw it working? I tried and I see that my FBO is unhappy when I try to attach the depth buffer. |
||||
|
||||
![]() Kwizatz GDNet+ Member since: 4/7/2000 From: San Jose, Costa Rica |
||||
|
|
||||
Looks good, now I may actually add FBOs to my shadowmaps and video to texture code , just one thing:Quote: Where is the link to said example program? |
||||
|
||||
![]() cyrfer Member since: 12/9/2006 From: Monterey, CA, United States |
||||
|
|
||||
| The tutorial is working well for me. I had a setting on my display that prevented any FBO code to work. Watch out that someone doesn't change your antialiasing settings behind your back! |
||||
|
||||
![]() henrym Member since: 2/12/2002 From: Christchurch, New Zealand |
||||
|
|
||||
Quote: Took me a while to find it too... It's in the right sidebar; the link is 'Source Code'. |
||||
|
||||
![]() Kwizatz GDNet+ Member since: 4/7/2000 From: San Jose, Costa Rica |
||||
|
|
||||
Quote: Thanks! |
||||
|
||||
![]() CyberSlag5k GDNet+ Member since: 4/25/2003 From: Blue Ash, OH, United States |
||||
|
|
||||
| Hmm... I'm still not seeing it. Is this side bar in the actual article itself? Without order nothing can exist - without chaos nothing can evolve. |
||||
|
||||
![]() fasthazard Member since: 3/18/2007 From: Raleigh, NC, United States |
||||
|
|
||||
| I too had trouble initally getting this stuff to work (compiling's the easy part). I'm using the glx_base code from the main nehe.gamedev site. I couldn't find the example code for the article, so I copied and pasted line by line. I'm running linux, so the following may be most interesting to other linux users. Here are the most important fixes: 1- use libglew (the "GL extension wrangler) to manage checking for hardware/driver support for extensions, and mapping the appropriate pointers. If you know the extension you want to use is supported, you can use glewInit() to do the rest of the setup. 2- It's important that you complete setting up the target texture. Specifically, you can't just call glTexImage2D(...). You must also have something like: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); If these parameters aren't set, the glCheckFrameBufferStatus(...) will give error 0x8cdd (unsupported). For the meaning of other errors, see http://www.nvidia.com/dev_content/nvopenglspecs/GL_EXT_framebuffer_object.txt . Good luck, Matt |
||||
|
||||
![]() BradDaBug Member since: 5/2/2001 From: Cuba, MS, United States |
||||
|
|
||||
| Here's the link to the source if anyone else is having trouble finding it: clicky |
||||
|
||||
![]() Oxidative Member since: 4/26/2007 From: Darmstadt, Germany |
||||
|
|
||||
| Has anyone else noticed a general performance problem with the FBO extension? The first time I start the example I get a pretty good framerate (~25fps), but after restarting the program the frames drop to 2-3fps! I thought it might be a cleanup problem, but it does call glDeleteFramebuffersEXT, glDeleteRenderbuffersEXT and glDeleteTextures at the end. Is there something missing? I'm having the same problem with my own program. Maybe a driver problem? I'm using a Nvidia Quadro FX 4500 X2 with the ForceWare 96.02 driver. |
||||
|
||||
![]() EonStrife Member since: 10/28/2003 |
||||
|
|
||||
| Hi, sorry for this silly question...But how can I access per-pixel data (color, or depth, etc.) of a renderbuffer object or texture object bound with FBO ? |
||||
|
||||
![]() taby Member since: 2/10/2005 From: Regina, Canada |
||||
|
|
||||
| The following code reads from the FBO's 0th attached floating point texture in GPU RAM and copies that data to an array in CPU RAM: vector<float> entry_points(4*width*height); // 4 channels per pixel glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); glReadPixels(0, 0, width, height, GL_RGBA, GL_FLOAT, &entry_points[0]); // Print array for(long unsigned int i = 0; i < width*height; i++) { cout << "R: " << entry_points[i*4 + 0] << endl; cout << "G: " << entry_points[i*4 + 1] << endl; cout << "B: " << entry_points[i*4 + 2] << endl; cout << "A: " << entry_points[i*4 + 3] << endl; } |
||||
|
||||
![]() EonStrife Member since: 10/28/2003 |
||||
|
|
||||
| @taby Thanks :) |
||||
|
||||
![]() jhondoe Member since: 4/29/2008 From: paris, France |
||||
|
|
||||
| Hi, I am looking for the source code of the example exposed in this tutorial. It it has made with freeglut. I did not see anywhere a link to download it. Thx John |
||||
|
||||
![]() jhondoe Member since: 4/29/2008 From: paris, France |
||||
|
|
||||
| Oh yeah I see now (I was on this one http://www.gamedev.net/reference/articles/article2331.asp) |
||||
|
||||
![]() jhondoe Member since: 4/29/2008 From: paris, France |
||||
|
|
||||
| Correct page: here A related question : here [Edited by - jhondoe on May 4, 2008 6:58:52 AM] |
||||
|
||||
![]() vodoo Member since: 10/19/2008 From: Gainesville, FL, United States |
||||
|
|
||||
| The concept does not work for me. My situation is slightly different, where I am calling a shader program on textures attached to the FBO. This is the rough idea: //MFC and OpenGL OnPaint() { //context set up. RC , DC etc. //get data from video frame and render glDrawPixels(x,y, data..); //bind to a FBO glBindFrameBufferEXT(GL_FRAMEBUFFER_EXT, fb); glPushAttrib(GL_COLOR_BIT | GL_VIEWPORT); glClearColor(..); //clear screen Myfunction(); //that internally calls my shader program glPopAttrib(); //at this stage I expect the viewport and color settings restored, but not so glBindFrameBufferEXT(GL_FRAMEBUFFER_EXT, 0); setViewPort(0,0,W,H); //need to do it again. .. }//This function is called again till number of available frames Here is what is going on in MyFunction() MyFunction() { setViewPort(0, 0, w, h); //W > w and H > h //take two textures and attach them to FBO a. set texture 1 with id tex[0] and other with id tex[1] b. Internal type : GL_RGBA_FLOAT32_ATI Pixel Data Format : RGBA Data Type: GL_FLOAT The pixel data is not related to video frame data. c. glBindFrameBufferTexture2DEXT(..) Shader(); //computes and produces yellow color } Shader() { //set up shader .. //read source files .. //compile .. //link .. //execute glProgramExecute(..) glDrawBuffers(2, buffers); //pass on any uniform data .. //render on quad drawQuad(w, h); //same size as that of view port } As you can see the shader computes yellow color. After coming out of shader the portion of the MFC screen where the first frame was drawn remains there but when it is the turn for the second frame to be drawn, insteead of next frame's data, the area is painted with color given out by shader. Any comments???? Need any other info ??? Help required.Thank you. } |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|