Using the Improved OpenGL Bindings in Lime 4

Lime 4 has been released, and among other changes, we have improved our support for OpenGL!

This is a companion discussion topic for the original entry at

Thank you so much Joshua for your hard work, this is awesome !

I’ve tried this version when it was in development, had the performance droping slowly on windows with my project.
I installed the 4.0.0 released version now with compatible openfl and tried it, it’s still happening.

Here is a video showing what’s going on

The FPS keeps droping, untill I create a new player, after inverstigation, It turns out creating a new textfield (starling) reset the fps back to 60. But that only works if the the stats are visible at the left corner… else the fps keeps droping even if I do nothing.

If I create a new TextField every frame, the FPS is stable between with stats visible.
Also I noticed sometimes there is weird behaviour like, z-index switching and texture disappearing.

Hope this helps, thank you !

@jinjinjin310 have you tried profiling your code with ? This would definitely help isolating the issue.

@tanis I have tried but when I compile with -Dtelemetry it just crashes at launch.

I think I found it:

There’s also a fix in Lime to improve OpenGL garbage collection. If you’re testing dev builds, please update and rebuild and see how it all works now

Yes it works, fixed the problem, thank you !

1 Like

Hello Joshua,

I ask you about improved OpenGL 4.2

Why does it not exist with glBegin and glEnd. I am sorry I hate webgl-version because webgl-version is very hard to understand. Where is clean and explanation from website. Why I have always wrong website if I can not find.

If I use real conversion from HTML / JS to HAXE from webgl-version ( gl-matrix 1.0 / 2.0 ) ( Why not use glBegin and glEnd version because glBegin and glEnd version is easy. )

And compilation shows me error if Float32Array should be “int” or “Float”. Since I create lime create HelloWorld. In OpenGL. I try but it still black. Nothing shows drawing of my custom gl-viewport.

My head always is hurting because webgl-version is for me very miss understandably.

Is there a way to specify the API when using the static GL class with the OpenGLView in OpenFL?

The static GL class resembles the GLRenderContext API, which is sort of a conglomeration of both WebGL and GLES APIs.

You should be allowed to cast it to one of the other API styles, though, for example:

var gl:WebGLContext = GL;

Support for GLES-specific APIs and WebGL2 APIs are still being polished, but this should be the basics of how the GL abstract types work :slight_smile:

1 Like