Carbon windows and AGL

Philippe C.D. Robert philippe.robert at gmx.net
Fri Apr 27 13:56:48 PDT 2007


On 27.04.2007, at 21:07, Uli Kusterer wrote:
>> I am developing a crossplatform rendering framework (in plain C)  
>> which is supposed to open multiple OpenGL windows, each one in its  
>> own posix thread. On OS X I create the windows using the  
>> CreateNewWindow function and a window event handler:
>>
>> CreateNewWindow(kDocumentWindowClass,  
>> (kWindowStandardHandlerAttribute| 
>> kWindowStandardDocumentAttributes), &winBounds, &w->winRef);
>>
>> My problem now is, the so created windows have no decoration at  
>> all and lie in the background. What am I doing wrong?
>
>  *never* create or manipulate GUI from any thread other than the  
> main thread. Unless it's explicitly documented as being thread- 
> safe, you can't assume an API to be safe for use from several  
> threads, nor from another thread than the main thread.

Well, I create one plain window for each thread to be used w/ OpenGL  
rendering, that's legitimate. Using

	ProcessSerialNumber psn = {0, kCurrentProcess};	
	TransformProcessType( &psn, kProcessTransformToForegroundApplication );
	SetFrontProcess( &psn );

I was able to solve the background issue. I still have some problems  
wrt event handling because I want to own the application main loop,  
but I will get there...

cheers,

-Phil


More information about the MacOSX-dev mailing list