mutual exclusion issues


I have two threads (or processes) that access two different rendering contexts, respectively. One of them never calls buffer swapping, SwapBuffer(). I just use it to do some matrices transformation. Do they interfere each other? In Win32, do I have to use CCriticalSection to protect some interfered code to ensure mutual exclusion? Please advise. Thanks.


Two contexts don’t interfere with each other, except the same context can only be current in a single thread at a time, and the same thread can only have one context current at a time.

However, using a GL context for matrix transformations is not the right thing to do. Download a good matrix or geometry package instead. Using GL for convenience matrix functions is just astoundingly inefficient. Switching contexts to do that sounds even worse.