GameMaker (2.0 - 2.2.x)

Get Shader Constants

Bart Teunis

You must be logged in to obtain assets



A simple script that uses a shader to get the built-in GLSL ES shader constants:

  • gl_MaxCombinedTextureImageUnits
  • gl_MaxDrawBuffers - Maximum number of render targets
  • gl_MaxFragmentUniformVectors
  • gl_MaxTextureImageUnits - Maximum number of samplers that you can access in the fragment shader
  • gl_MaxVaryingVectors
  • gl_MaxVertexAttribs
  • gl_MaxVertexTextureImageUnits
  • gl_MaxVertexUniformVectors
  • _VERSION_ - OpenGL version, returns 100

For a complete overview, see the section 7.4 Built-in Constants in The OpenGL ES Shading Language.

The value of _VERSION_ is included out of convenience.

Using the script

Import all files into your project and execute the script once at the start of the game:

map_constants = shu_get_shader_constants();

map_constants now holds a reference to a ds_map with the above values in it.

End User Licence Agreement (EULA).

Age Rating: 4+


GMS2 - Version 1.0.0. Published October 20, 2019

Initial upload

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait