PDA

View Full Version : FBO and threading



prisoner52
02-17-2011, 05:33 AM
Hi

I am making a game and I want to render all my objects in one buffer and then to render all objects that glow into another FBO.

but this is slowing down my FPS. so I was planning on creating a thread for the FBO(bloom effects) and do all the rendering seperately.

what I want to know is will this work?
will it improve performance?
and what steps do i have to do to make a FBO work in a seperate thread and if opengl calls can work in parallel to my main thread.
i've seen that you need to create an opengl context and share information but i don't have any examples of how to do this.

any help would be really appriecated because i don't know if this will improve performance or how to seperate opengl into different threads.

thanks

ZbuffeR
02-17-2011, 06:14 AM
The GPU can not render in parallel, so the only benefit would be to better use the CPU(s). Will not help if the current bottleneck is the GPU.

Can you explain how you currently render your objects ? Do you reuse vertex buffers between the renders, etc ? How much time per frame for rendering separately, versus no FBO used ?

prisoner52
02-17-2011, 07:08 AM
I'm using display lists for my objects

I draw the objects in the scene.

then I bind the FBO and redraw the objects i want to glow and then draw the the other objects set to the clear color so that they remove the overlap on the glowing objects.
then i get the texture from the FBO and pass it through the verticle and horizontal fragment shaders then draw a quad over the screen with the attached texture.

not sure how to test without the FBO because i need it to generate a texture.

ZbuffeR
02-17-2011, 09:05 AM
Please avoid opening multiple threads for the exact same problem.
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=291869

V-man
02-17-2011, 10:30 AM
not sure how to test without the FBO because i need it to generate a texture.

Just render to the FBO once.
What kind of FPS are you getting?
Perhaps render to the FBO every other frame.

prisoner52
02-23-2011, 03:40 AM
thanks a lot i could probably cut down on rendering to the FBO I also started to look thru my code and cut out a lot of pointless gl calls used gdedebugger to find some as well so its running faster now alot of other calculations were removed which seemed to be slowing it down a bit.