OpenGL, mpeg2, avi files and threads

Hi…

I have a small problem with OpenGL in multithread env. Im try to play mpeg2 or AVI
files in OpenGL texture object. I’ll try to modify Texture3D example from DirectX sdk.
The problem is video didn’t show on screen. My app create two rendering contexts and share lists between. If I upload texture in CTexRenderer: oRenderSample and render in main app thread, nothing happends. But if I upload texture CTexRenderer: oRenderSample
and render in same func, texture show’s up in
window.

Whats going on? I have lock/unlock code in all functions that call gl. Also I have
context switching in CTexRenderer: oRenderSample, and in main render loop.

pseudo code…
hDC and hRC are globals…
Lock are CCritSect global object

CTexRenderer:OnRenderSample()
{
if (LocalRC!=NULL)
{
LocalDC = hDC;
LocalRC = wglCreateContext(hDC);
wglShareLists(hRC, LocalRC);
}
}

CTexRenderer: oRenderSample(Sample *pSample)
{
Lock.Lock();
wglMakeCurrent(LocalDC, LocalRC);
bind texture…
glTexSubImage(…); //upload image data…
// if I put RenderFrame code here, it show’s
// in window
Lock.Unlock();
}

App:RenderFrame()
{
Lock.Lock();
wglMakeCurrent(hDC, hRC);
enable texture…
bind texture…
render quad
Lock.Unlock();
}

yooyo