how to use the opengl successfully in the launched

I am tring to use opengl es in the launched thread in the windows mobile on Dell x51v,  in the PC emnunation the opengl es works well in the launched thread, but in the windows mobile version, the main program broken,  how could i use the opengl successfully in the launched thread?

Please do not create multiple threads for the same question, it only leads to fragmented answers.





I am not sure I understand your question correctly, though. Are you trying to use OpenGL ES in a multithreaded application? And if so, what are the steps you perform to create the render thread?

hi,  i just want to use opengl es in the launched thread,


my program like this in window mobile platform on dell x51v device

 

DWORD WINAPI ThreadProc(LPVOID lpParameter)
{

     //init the opengl

          ....code of init....

 

    for(i = 0; i < 220; ++i)
    {

            //draw triangle ...

              ....code of drawing triangle...

           eglSwapBuffers(eglDisplay, eglSurface);

     }


    return 0;
}

 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, TCHAR *lpCmdLine, int nCmdShow)
{

     .......

     //launched the thread

     HANDLE hThread=CreateThread( 0, 0, ThreadProc, 0, 0, 0);

     ......

}

 

when running this program, i can saw the triangle, but soon the program crashed. but if i put the opengl es initiation and drawing code in the main thread, the program works well.  but the project requests to put the opengles code in the launched thread, how cauld i overcome it?

 

 

 

If you remove the triangle drawing code and simply call eglSwapBuffers does the application still crash? As you may be aware OpenGL implementations are not guarantee to be thread-safe, but if they’re only accessed from a single thread you should be ok. Can you narrow down what is actually causing the problem, eliminate any possible thread issues in your code? Without knowing exactly what your program does and where data is created it’s hard to work out where the crash may be and what’s causing it.





Sadly if there is a problem in the drivers it’s unlikely that this platform will receive a patch as Dell discontinued the device a while back.Gordon2009-09-03 16:54:28