[Bf-committers] Python on OS X Thought

Maarten Gribnau bf-committers@blender.org
Mon, 14 Apr 2003 15:18:21 +0200


>
> At the risk of giving Maarten an absolute heart attack, I wanted to  
> suggest something that might improve Blender's python capabilities on  
> OS X.
If that would give me heart-attack I would have been six feet under  
years ago ;-)

> This could be a dead end, but I stumbled across some documentation on  
> Apple's Developer web site that indicated that many OpenGL functions,  
> including the troublesome glClearColor, are UNSUPPORTED in the Carbon  
> framework. I know that most if not all of blender's OS X work has been  
> done in the Carbon framework (since the cocoa framework isn't even  
> referenced), and I wonder if this is a problem that won't go away  
> until we switch to Cocoa?
>
> Here's the reference:
> http://developer.apple.com/techpubs/macosx/Carbon/graphics/OpenGL/ 
> AGL_OpenGL/Functions/Miscellaneou71456789101112.html#//apple_ref/c/ 
> func/glClearColor
I think the documentation page is in error or outdated. All the OpenGL  
functions are listed as unsupported but they all are available and  
working fine through Carbon. Maybe they refer to an old version of  
Carbon on MacOS 9?

>
> I really hope that I'm wrong here, but if I'm right, is it just a  
> matter of changing references to Carbon.h to Cocoa.h and linking  
> against the Cocoa.framework instead of Carbon.framework?
It's not that simple. You would need to recreate the three Carbon  
related objects (the Window, System and Display manager) in the ghost  
library for Cocoa. You need to make a bridge from C++ (ghost is written  
in it) to Objective C (Cocoa is written in it).
Although Cocoa is the recommended API for working with osx, Carbon was  
not limiting so far. From a puristic point of view I agree that  
ghost/Cocoa would be better but it will take some work.
Do you see other reasons for moving to Cocoa?

> How could this be tested?
By writing a new ghost target for Cocoa.

Besides the implementation issues, I doubt that switching to Cocoa will  
solve Blender's OpenGL problem on osx. I am aware of one problem with a  
flickering display that is due to the way Blender uses the back and  
front buffers. This problem went through the official Apple bug  
handling process (back in the NaN days). Apple found that Blender's use  
of these buffers is against "official OpenGL guidelines". It interferes  
with their window manager I believe that does buffer tricks for such  
eye candy like drop shadows on windows.
According to Daniel (who worked on this) the problem can't be resolved  
unless we remove all that back and front buffer switching code from  
blender. This solution gets my vote.

Maarten