Are there any stencils & depth buffer?

Community Forums/Monkey Talk/Are there any stencils & depth buffer?

Casaber(Posted 2015) [#1]
Hey everyone !

Currently reading up and trying to learn all about Monkey but I´m not clear about how it differs from BlitzMax exactly. I see both have something I like though.

I have to make a choice though (as time are short) between BlitzMAX and Monkey and what it boils down to for me now is the access to depth/stencil/ackumulation/alpha buffers (hardware speed they provide are key for this project).

Do those things exist in some shape within Monkey and Mojo2?

Thanks !


xlsior(Posted 2015) [#2]
Depending on what you're hoping to accomplish: There's also Burcey's blitzmax-NG, which is mostly Blitzmax but with a bunch of additions such as multi-platform (Linux, Android, iOS, etc. 32-bit, 64-bit...)

Free download, search the forum for links.


Kryzon(Posted 2015) [#3]
Alright, I was curious so I investigated. The desktop target, GLFW, disables the alpha and stencil buffers upon creation as can be seen here:
https://github.com/blitz-research/monkey/blob/develop/targets/glfw/modules/native/glfwgame.cpp#L648
With the "SetGlfwWindow" function here: https://github.com/blitz-research/monkey/blob/f87aed95be400e108fd00845725c64206d8f0f97/targets/glfw/modules/native/glfwgame.cpp#L579

GLFW doesn't seem to have an API for setting an accumulation buffer, but accumulation buffers in particular are an old technique that is obsolete on recent GPUs. They are not hardware accelerated but rather emulated.

If you want to use the alpha and stencil buffers then instead of using SetDeviceWindow on your OnCreate method, call the SetGlfwWindow function directly.

http://www.monkey-x.com/Community/posts.php?topic=8987&post=94201


Casaber(Posted 2015) [#4]
@Xlsior
Thanks ! I tried BMaxNG but it always gets stuck compiling anything I throw to it so I guess it needs some more time, but I will certainly follow it up.

@Kryzor
Great info, thanks !

What about depthbuffers? Does e.g. DrawImage / DrawImageRect use depthbuffers under the hood to minimise overdraws?


Kryzon(Posted 2015) [#5]
No, but it seems straightforward to add glEnable(GL_DEPTH_TEST) and glDepthFunc(GL_LESS) to mojo, the renderer module:
https://github.com/blitz-research/monkey/blob/develop/modules/mojo/native/mojo.glfw.cpp#L213

EDIT: If you're that concerned about the internal behaviour then you might as well dig through the source files.


Casaber(Posted 2015) [#6]
@Kryzon Great idea, I noticed the sourcecode wasn´t that hefty as I thought it was.