[Tutor] Best tool for programming interactive games in Python

Alan Gauld alan.gauld at btinternet.com
Thu Mar 31 18:14:08 EDT 2016


On 31/03/16 20:27, Oscar Benjamin wrote:

>>> OpenGL plays nicely with Windows and Linux as well.
>>
>> mix n' match the OSX graphics libraries. You can't do that as easily
>> in X or Windows is an add-on library, not a native part of the OS.
> 
> That's interesting. I've used OpenGL on Windows and Linux but not on
> OSX so I'm not sure exactly what you mean. 

I can't speak for Linux because, although it's my main platform
I've not done much graphics on it. But on Windows the core OS APIs
all use a device context or GDI object to do their painting. To
use OpenGL you need to bridge between the GDI of native windows
and the OpenGL libraries. If you want to draw a moving string for
instance you need to either use the Windows graphics system
or the OpenGL system. In MacOS X the ODS system is OpenGL so
you can use the native API interleaved with your OpenGL code.

> (Unity, Gnome3, KDE4, etc.) use OpenGL-based compositing just like OSX
> does and I'm fairly sure Android does as well. Does it just work out
> better on OSX?

That's news to me, I thought they(Linux) all worked through the
X layers (Xlib, Xt etc).

> I know that work is under way to replace X itself with Wayland and
> reimplement the core toolkits (Gtk, Qt, etc) on top of Wayland with
> OpenGL as the core

Yes, and at that point I'd expect Linux to be as seamless as MacOS.
But for now it seems to me that you still have to initialise libraries
and explicitly link your OpenGL objects to your OS (X)windows etc.
In short you have to tell the OS GUI that you are choosing to render
on OpenGL and/or use the OpenGL library routines to do any drawing.
It's a one or the other approach.

In MacOS it's (almost) a mix n match approach, you can use whichever
API call is easier for you, OS or OpenGL native and interleave them.
There are some issues that arise but I don't do enough graphics
work to fully understand them! For my simple needs it all pretty
much just worked.

PS.
When I write MacOS above I suspect I should really be saying
Cocoa, but I'm, not even expert enough in MacOSX to be sure of
that! :-)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list