wxMax, Mac and BRL.GLGraphics

BlitzMax Forums/Brucey's Modules/wxMax, Mac and BRL.GLGraphics

Brucey(Posted 2008) [#1]
Well, I've managed to get a "normal" GLGraphics window working *with* wxMax on OS X.

This is interesting because it's mixing Carbon (wxMax) and Cocoa (BRL.GLGraphics) APIs in the same app.

The main reason I was playing around with this was to try to get a full-screen graphics mode working from a wxMax application - that's rather than a full-screen Window with a GLCanvas in it.

I'm having problems with full-screen still, but at least as a proof of concept for mixing APIs the basics are working well so far, it seems.

Here are the parts for playing :

graphicstest.bmx


cocoa_glue.bmx
SuperStrict

Import "cocoa_glue.m"

Extern

	Function initCocoa()

End Extern


cocoa_glue.m
#import <Cocoa/Cocoa.h>
#include <brl.mod/blitz.mod/blitz.h>

static NSAutoreleasePool * cocoaPool;

void initCocoa() {

	if (! cocoaPool) {
		cocoaPool = [[NSAutoreleasePool alloc] init];
		NSApplicationLoad();
	}

}


If you try the full-screen mode you'll find that it doesn't process any events (or at least, rarely!!). To get out of it, use cmd-Q to quit the app.
The windowed mode works well, and you can close it by pressing Escape.

Notice that I'm using the wxAppMain type instead of the usual wxApp. This provides you with direct access to the "main loop", rather than firing events to update your graphics window. This should, in theory, give you more control over everything.

I'm not sure why there are no events processed after the mode change. I can only assume that something else is going on underneath that's not passing them thru to where I need them.

If anyone has any bright ideas....

;-)