Threads and OpenGL

Started by
1 comment, last by Riskbreaker 21 years, 11 months ago
Here''s my basic scenario: I''m writing a pictures screen saver in OpenGL. The program needs to load pictures as it goes. I''ve set up threads to load pictures in the background. These are the basic Win32 threads (_beginthread). Here''s the problem: Whenever certain functions are run by the threads, they screw up the output. The primary example is gluScaleImage. Anyone have any experience on how to fix this? I''m sure the thread''s finishing before the memory is being accessed for display. The functions work fine if I remove the thread. Thank you sooo much!
--RiskbreakerCoding Soul
Advertisement
OpenGL only works with access to a context from a single thread at any given time. If you wish to employ more than one thread, you must completely unload and disassociate the rendering context (and all associated objects) before switching threads. Since this normally isn''t very practical, the conventional wisdom is to restrict all OpenGL operations to a single thread.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
That being the case, does anyone know of a substitute for gluScaleImage? Calling this function during my rendering pauses the display temporarily, which is really annoying. I need a function I can call in a thread.
--RiskbreakerCoding Soul

This topic is closed to new replies.

Advertisement