- "Packaging" class member functions as closures - 2 Updates
bitrex <bitrex@de.lete.earthlink.net>: Sep 04 02:45PM -0400 It was suggested to me that my OpenGL "game engine" could be improved by having the thread with the OpenGL context execute "scripts" that are passed to it from game objects in another thread via a locking queue. This makes sense since OpenGL isn't intrinsically multithreaded, and simply trying to make OpenGL calls (e.g. the GPU shader pipeline specifically) across threads via say a vector of weak pointers held by the thread with the active context has caused me grief. Using lambdas/closures was suggested as a way to accomplish this by putting say a member "render" function, object, and arguments into a package that could be passed over through the queue. I'm not super-familiar with lambdas and the stuff that's now possible with std::function post C+11, wondering if anyone could give a reference or example as to how something like this would be done? |
"Chris M. Thomasson" <invalid@invalid.invalid>: Sep 04 11:59AM -0700 On 9/4/2017 11:45 AM, bitrex wrote: > super-familiar with lambdas and the stuff that's now possible with > std::function post C+11, wondering if anyone could give a reference or > example as to how something like this would be done? This might be of interest to you: https://software.intel.com/sites/default/files/Designing_a_Parallel_Game_Engine.pdf |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment