Board index » cppbuilder » OpenGl Texture sharing between main application and thread?
Cagatay Undege
![]() CBuilder Developer |
Wed, 18 Aug 2004 16:53:07 GMT
|
Cagatay Undege
![]() CBuilder Developer |
Wed, 18 Aug 2004 16:53:07 GMT
OpenGl Texture sharing between main application and thread?
Hi,
I developed a OpenGL component. Thanks Cagatay |
Scott Heima
![]() CBuilder Developer |
Wed, 18 Aug 2004 21:17:02 GMT
Re:OpenGl Texture sharing between main application and thread?An OpenGL render context can be current in only 1 thread at a time. Therefore, you cannot make OpenGL calls in your GUI thread while your render context is current in your render thread. The solution to the problem is to "protect" the render context with a file://-------------------------------------------------------------------- while ( m_KeepLooping ) return 0; // disable floating point exceptions // create a thread for the render loop m_Initialized = true; // call any OpenGL initialization functions here FreeRC(); // try to make the RC current in this thread WaitForSingleObject( m_RenderThread, 5000 ); DeleteCriticalSection( &m_RCMutex ); // clean up OpenGL stuff file://-------------------------------------------------------------------- |
Cagatay Undege
![]() CBuilder Developer |
Thu, 19 Aug 2004 00:31:19 GMT
Re:OpenGl Texture sharing between main application and thread?With that method will the texture created by the GUI function be used by the thead also? I mean texture will be created from GUI, but the thead will use it for displaying. Thank you very much, Cagatay QuoteScott Heiman <addr...@home.page> wrote in message news:3c80d07c$1_1@dnews... Quote> ------ Quote> ------ Quote> ------ Quote> ------ Quote> ------ Quote> ------ - Hide quoted text - - Show quoted text - Quote> ------ Quote> ------ - Hide quoted text - - Show quoted text - Quote> ------ - Hide quoted text - - Show quoted text - Quote> ------ |
Scott Heima
![]() CBuilder Developer |
Thu, 19 Aug 2004 02:49:51 GMT
Re:OpenGl Texture sharing between main application and thread?That depends upon your implementation. Typically, I will open an image file in the GUI thread, parse the pixel data I use the folowing code snippet in the render loop to display the texture: // MakeTexture is set to true in the GUI thread that opens an image file if ( HasTexture ) -- |
1. how to terminate a thread from main thread of a application
2. difference between Main Thread of VCL application and CreateThread
3. Connection.Writeln from VCL-Main-Thread and Client-Thread
4. a riddle about TAutoObject descendant, main VCL thread, and single apartment thread
5. Creating and using form inside thread hangs main window till thread completes
6. float behaves different in main thread from second thread
7. Generating and Deleting textures in Delphi/OpenGL