Getting the native graphics context?

Monkey Targets Forums/Desktop/Getting the native graphics context?

Nobuyuki(Posted 2013) [#1]
Hey!

I want to extend SetBlend on GLFW target (and maybe in the future, other targets which support glBlendFunc) without hacking mojo. The purpose is to make the code redistributable -- but, to get it to work right would require calling gxtkGraphics::Flush() on the currently active graphics context. However, my C++fu rather sucks, and I'm not sure what the correct calling convention would be to get this to work on the cpp side!

Any advice?


therevills(Posted 2013) [#2]
In v68+ you can get the Mojo graphic's instance by the following:

extern.cpp
extern gxtkGraphics *bb_graphics_device;

Then you can at least get the fields:
bb_graphics_device->height

Not sure if you can call Flush though, might be worth ago :)


Nobuyuki(Posted 2013) [#3]
THANKS, this works on v66b too! I'll have something ready in User Modules soonish....


Nobuyuki(Posted 2013) [#4]
As promised, here is the user module:

http://www.monkeycoder.co.nz/Community/posts.php?topic=4749

A bit of a work-in-progress, but it does compile on at least one target :)


therevills(Posted 2013) [#5]
Cool! Glad it worked :) (I'm supervised it worked for v66, but hey I hate C++ ;))