1:opengl 多线程共享纹理纹理:
//解码时候使用opengl进行绘制,需要构建队列和两个线程,分别用于解码数据并且填充纹理和渲染。
主线程常见两个共享上下文:
main()
{
⋯⋯⋯⋯
gHdc = wglGetCurrentDC();
gHRC1 = wglCreateContext(gHdc);
gHRC2 = wglCreateContext(gHdc);;
wglShareLists(gHRC1,gHRC2);
⋯⋯⋯⋯
exit:
wglMakeCurrent(NULL,NULL);
}

Thread1()
{
⋯⋯⋯⋯
wglMakeCurrent(gHdc,gHRC1);
⋯⋯⋯⋯
wglDeleteContext(gHRC1);
}

Thread2()
{
⋯⋯⋯⋯
wglMakeCurrent(gHdc,gHRC2);
⋯⋯⋯⋯
wglDeleteContext(gHRC2);
}

05-08 08:42