Kazade / kazmath

A C math library targeted at games
Other
522 stars 94 forks source link

Kazmath's GL stack doesn't allow for multiple GL contexts/multithreading #10

Closed starbugs closed 11 years ago

starbugs commented 11 years ago

Unfortunately, the current GL stack implementation crashes when calling it from different threads using multiple OpenGL contexts. As I required this specific functionality, I forked kazmath and implemented a TLS based context switch for the stack module (see http://github.com/starbugs/kazmath).

With my modifications, the only thing people have to do when they switch GL contexts is to call kmGLSetCurrentContext(void *) providing a reference to some external context representation that is constant for the lifecycle of a given real GL context. kazmath will then provide a stack for each context automatically (without any changes to the stack interface). My modifications merely require linking to libpthread.

Some background info: I am authoring a GL-based UI framework for iOS/Mac OS X which uses kazmath for most of the math and vector stuff (http://github.com/starbugs/icedcoffee). My modifications have been tested by a very small group of people currently experimenting with my framework -- no issues so far.

Anyway, I thought I just give you a ping and ask whether you're interested in pulling these changes? Maybe they are beneficial to others...

Big thanks for the great library!

Tobias

Kazade commented 11 years ago

Awesome work. I'll pull those two commits into master if that's OK with you?

starbugs commented 11 years ago

Thank you, that's great!

Kazade commented 11 years ago

Merged!