GLES Shader Testing in Desktop

Writing shaders to support mobile devices might be not trivial. You may wondering is there a way to test shader in mobile devices without really using mobile device.

The answer is yes, there's a way.

Desktop GPU nowadays (even integrated one) should supports creating OpenGLES context, which means all shaders must be GLSLES/ESSL compatible. We can make LOVE to use OpenGLES context by using environment variable LOVE_GRAPHICS_USE_OPENGLES=1.

Requirements

You need GPU which supports OpenGLES context. As previously written, todays desktop GPU should support this.

If your GPU doesn't supports it, you might can use ANGLE. If you're under Windows, you can actually run LOVE using only DirectX 9 capable GPU by using ANGLE (you can grab the DLLs from your Google Chrome or Firefox installation, named libegl.dll and libopenglesv2.dll. Just make sure it's 32-bit DLLs if you're using 32-bit version of LOVE (same also for 64-bit) and place it beside love.exe).

Tell LOVE to use OpenGLES context

Now, we need to tell LOVE to use OpenGLES context. You need to set this environment variable before starting LOVE. It can be set using Command Prompt/Terminal and launching LOVE from same Terminal, or from Windows, from Advanced System Settings.

  • Windows: set LOVE_GRAPHICS_USE_OPENGLES=1 then lovec ... (this assume 0.10.2 used)
  • Linux/macOS: LOVE_GRAPHICS_USE_OPENGLES=1 love ...

Verify if LOVE uses OpenGLES context by calling love.graphics.getRendererInfo and check if the 1st return value is "OpenGL ES".

Once you got OpenGLES context, you can test your shader code if it works under mobile devices.