89 replies to this topic
Posted 11 months ago #76

What the hell. This is the 3rd time I answer now.


Let's see if that disapears again, LOL.

Posted 10 months ago #77

Sorry for delay. I’ve just released an update. All issues should be fixed.


* Added textured DrawPoly support
* Added support of async image loader
* Fixed value returned by getContext function for webgl and expreimental-webgl contexts
* Fixed issues with App.OnLoading event

Posted 10 months ago #78

Thanks man, just tried it and it works like a charm!

Posted 10 months ago #79

Hi, thanks for the update, I just tried with the async image loader and it does not work? it stops the image from downloading, any ideas?
(Monkey v76a)

Import mojo

Class MyApp Extends App Implements IOnLoadImageComplete

	Field image:Image

	Method OnCreate()
		LoadImageAsync( "",1,Image.MidHandle,Self )
		SetUpdateRate 60
	Method OnUpdate()
	Method OnRender()
		DrawText "Hello World!",0,0
		If image Then DrawImage image,DeviceWidth()/2,DeviceHeight()/2
	Method OnLoadImageComplete:Void( image:Image,path:String,source:IAsyncEventSource )
		If image Then Print "OK!" Else Print "ERR"


Function Main()
	New MyApp
Posted 10 months ago #80

@MikeHart glad to hear it!

@CopperCircle server with files must have special headers for allowing cross-domain image loading. More info: Your code will work in 2d context as well, but it won’t in webgl because it requires more rights for texture binding.

Also, script may work not properly with experimental Monkey versions, because I test code only with stable builds

Posted 10 months ago #81

Thanks for the tip, didn't realise webgl needed more rights.

Posted 8 months ago #82

Hi, can this be made to work with WebGL in IE11?

Posted 8 months ago #83

Hi, WebGL support in IE is slightly incomplete, but this issue can be solved. I started to work on it, but currently it is not my priority task. Sorry.

Posted 8 months ago #85

I also noticed that this module does not work with IE11. I would also like it if IE is supported. In the mean time I use this to disable WebGL for IE11. It checks if the user agent does not have the word "trident" in it. "trident" is only used in the IE11 user agent string. So it is a temporary fix until IE11 is supported.

function init(id) {
		if (window.WebGLRenderingContext !== undefined) {
			if(navigator.userAgent.toLowerCase().indexOf('trident') === -1) {
				try {
					new WebGL2D(document.getElementById(id));
				} catch (e) { }
Posted 3 months ago #86

Why doesn't Mark include this patch in all monkey releases again?

Posted 2 months ago #87

Great work!

@marksibly : Please have a look here!

Posted 1 month ago #88

This patch is deprecated!
There won’t be no updates, no bugfixes, no compatibility with new Monkey versions.

How to add WebGL support for mojo now?
I made new implementation of WebGL support for mojo in my Monkey fork - mungo. It’s a better implementation which gives ~10 time better performance than this patch and works in IE11. Here is a small demo.

Now you can use these two methods to enable WebGL acceleration for your mojo projects:

1. Download and install mungo
The fastest way to use new WebGL implementation for mojo is to download and install mungo.

2. Create custom HTML5 target
If you don’t want to use mungo you can add WebGL support for mojo by following this short manual:

1. Create a new HTML5 target based on the standard HTML5 monkey target.
2. Rename directory of the new target. For example: html5_webgl
3. There, replace files in modules/native folder by files from mungo
4. Rename new target in TARGET.MONKEY file. For example: #TARGET_NAME="Html5 WebGL Game"
5. Copy-paste code from mojo.html5.webgl.js file into template/main.js file after //${TRANSCODE_END} line
6. Add #HTML5_WEBGL_ENABLED=True in template/CONFIG.MONKEY file

Posted 1 month ago #89

Ah excellent - I've been missing this target in newer versions as I always tested using it, and now I can again.

Thanks devolunter.