Home » Community » Forums » » OpenGL FrameBuffer Object 101
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 OpenGL FrameBuffer Object 101
Post Reply 
Oh
My
God

Rate++++++++++++++++++++++++++++++++++++++++++++++++

 User Rating: 1168   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

You sing very well. Nice voice!

 User Rating: 1469   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Quote:
Original post by MENTAL
Oh
My
God

Rate++++++++++++++++++++++++++++++++++++++++++++++++


Indeed, It was a very clear article.

Regards
elFarto

 User Rating: 1041   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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 ]


 User Rating: 1251   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

Yep - very nice article - cheers Rob!

 User Rating: 1093   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

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.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Looks good, now I may actually add FBOs to my shadowmaps and video to texture code , just one thing:

Quote:

The example program requires some form of GLUT to be compiled and run (I used FreeGLUT)


Where is the link to said example program?

 User Rating: 1567   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

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!

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by Kwizatz
...

Where is the link to said example program?

Took me a while to find it too... It's in the right sidebar; the link is 'Source Code'.



 User Rating: 996   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by henrym
Quote:
Original post by Kwizatz
...

Where is the link to said example program?

Took me a while to find it too... It's in the right sidebar; the link is 'Source Code'.


Thanks!

 User Rating: 1567   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

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.


 User Rating: 1269   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Here's the link to the source if anyone else is having trouble finding it: clicky

 User Rating: 1383   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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 ?

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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;
}

 User Rating: 1355   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

@taby

Thanks :)

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Oh yeah I see now

(I was on this one http://www.gamedev.net/reference/articles/article2331.asp)

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Correct page: here

A related question : here

[Edited by - jhondoe on May 4, 2008 6:58:52 AM]

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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.







}

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: