OpenGL on Monkey

Monkey Forums/Monkey Programming/OpenGL on Monkey

JaviCervera(Posted 2011) [#1]
Is it possible to use OpenGL on Monkey directly?

I would like to port the OpenGL BlitzMax module to Monkey and use it with the GLFW target, but many functions use pointers, which are not supported on Monkey.

If I define a function argument as an array, would it receive a pointer to a C++ array when translated to that language, or are arrays objects? In that case, I guess I could always write a memory banks module and pass the bank handle to OpenGL where it expects a pointer.

Anyway, I am amazed by Monkey. It's the most exciting thing that has happened in years in the game programming world :)


Qube(Posted 2011) [#2]
I'd like access to OpenGL commands too :)


MikeHart(Posted 2011) [#3]
As there are no pointers, I think the only way for you is to create a module with a native part for it.


JaviCervera(Posted 2011) [#4]
Or creating a Bank module, with Blitz-like bank functions:

Local bank:Int = CreateBank(size)
'Fill bank, etc
glDrawElements( GL_TRIANGLES, numTris, GL_FLOAT, bank)

CreateBank() would return the bank handle, which is a pointer to the reserved memory area, so OpenGL would receive the pointer it expects when passing it the bank handle as the 4th parameter of glDrawElements.