Get Window Handle in OpenGL (and on Mac)

BlitzMax Forums/BlitzMax Programming/Get Window Handle in OpenGL (and on Mac)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You can get the hwnd without modifying BRL module. Just do some copy work.
C side:
#include <windows.h>
/* copied from BRL.glgraphics */
typedef struct BBGLContext{
	struct BBGLContext *succ;
	int mode,width,height,depth,hertz,flags;
	HDC hdc;
	HWND hwnd;
	HGLRC hglrc;
} BBGLContext;


HWND getGLhwnd(BBGLContext *c){
	return c->hwnd;
}


BMX side:

Import "glhwnd.c"
Extern
	Function getGLhwnd:int(c:Int)
End Extern

'test
Local g:TGLGraphics = TGLGraphics(GLGraphics(640, 480)) 'get GLGraphics
print getGLhwnd(g._context)


This works on win32. No idea about Macos (since I don't have one).