global gl

methods

gl.HasExtension

function gl.HasExtension(ext: string) ->  boolean

[source]

gl.GetNumber

function gl.GetNumber(
  pname: GL,
  count: integer?
) ->  number...

@param count - (Default: 1) Number of values to return, in range [1, 64].

Get the value or values of a selected parameter.

[source]

gl.GetString

function gl.GetString(pname: GL)

Get a string describing the current OpenGL connection.

[source]

gl.GetScreenViewTrans

function gl.GetScreenViewTrans()
 -> x number
 -> y number
 -> z number

[source]

gl.GetViewSizes

function gl.GetViewSizes()
 -> x number
 -> y number

[source]

gl.GetViewRange

function gl.GetViewRange()
 -> nearPlaneDist number
 -> farPlaneDist number
 -> minViewRange number
 -> maxViewRange number

[source]

gl.SetSlaveMode

function gl.SetSlaveMode(newMode: boolean)

[source]

gl.ConfigMiniMap

function gl.ConfigMiniMap(
  px: integer,
  py: integer,
  sx: integer,
  sy: integer
)

[source]

gl.DrawMiniMap

function gl.DrawMiniMap(defaultTransform: boolean?)

@param defaultTransform - (Default: true)

[source]

gl.BeginText

function gl.BeginText()

[source]

gl.EndText

function gl.EndText()

[source]

gl.Text

function gl.Text(
  text: string,
  x: number,
  y: number,
  size: number,
  options: string?
) ->  nil

@param options - concatenated string of option characters.

  • horizontal alignment:
  • ‘c’ = center
  • ‘r’ = right
  • vertical alignment:
  • ‘a’ = ascender
  • ‘t’ = top
  • ‘v’ = vertical center
  • ‘x’ = baseline
  • ‘b’ = bottom
  • ‘d’ = descender
  • decorations:
  • ‘o’ = black outline
  • ‘O’ = white outline
  • ’s’ = shadow
  • other:
  • ‘n’ = don’t round vertex coords to nearest integer (font may get blurry)

[source]

gl.GetTextWidth

function gl.GetTextWidth(text: string) -> width number

[source]

gl.GetTextHeight

function gl.GetTextHeight(text: string)
 -> height number
 -> descender number
 -> lines integer

[source]

gl.Unit

function gl.Unit(
  unitID: integer,
  doRawDraw: boolean?,
  useLuaMat: integer?,
  noLuaCall: boolean?,
  fullModel: boolean?
)

@param doRawDraw - (Default: false)

@param noLuaCall - (Default: false) Skip the DrawUnit callin.

@param fullModel - (Default: true)

Draw the unit, applying transform.

[source]

gl.UnitRaw

function gl.UnitRaw(
  unitID: integer,
  doRawDraw: boolean?,
  useLuaMat: integer?,
  noLuaCall: boolean?,
  fullModel: boolean?
)

@param doRawDraw - (Default: false)

@param noLuaCall - (Default: true) Skip the DrawUnit callin.

@param fullModel - (Default: true)

Draw the unit without applying transform.

Also skips the DrawUnit callin by default so any recursion is blocked.

[source]

gl.UnitGL4

function gl.UnitGL4()

[source]

gl.UnitTextures

function gl.UnitTextures(
  unitID: integer,
  push: boolean
)

@param push - If true, push the render state; if false, pop it.

[source]

gl.UnitShape

function gl.UnitShape(
  unitDefID: integer,
  teamID: integer,
  rawState: boolean?,
  toScreen: boolean?,
  opaque: boolean?
)

@param rawState - (Default: true)

@param toScreen - (Default: false)

@param opaque - (Default: true) If true, draw opaque; if false, draw alpha.

[source]

gl.UnitShapeGL4

function gl.UnitShapeGL4()

[source]

gl.UnitShapeTextures

function gl.UnitShapeTextures(
  unitDefID: integer,
  push: boolean
)

@param push - If true, push the render state; if false, pop it.

[source]

gl.UnitMultMatrix

function gl.UnitMultMatrix(unitID: integer)

[source]

gl.UnitPiece

function gl.UnitPiece(
  unitID: integer,
  pieceID: integer
)

[source]

gl.UnitPieceMatrix

function gl.UnitPieceMatrix(
  unitID: integer,
  pieceID: integer
)

[source]

gl.UnitPieceMultMatrix

function gl.UnitPieceMultMatrix(
  unitID: integer,
  pieceID: integer
)

[source]

gl.Feature

function gl.Feature(
  featureID: integer,
  doRawDraw: boolean?,
  useLuaMat: integer?,
  noLuaCall: boolean?
)

@param doRawDraw - (Default: false)

@param noLuaCall - (Default: false) Skip the DrawFeature callin.

Draw the feature, applying transform.

[source]

gl.FeatureRaw

function gl.FeatureRaw(
  featureID: integer,
  doRawDraw: boolean?,
  useLuaMat: integer?,
  noLuaCall: boolean?
)

@param doRawDraw - (Default: false)

@param noLuaCall - (Default: true) Skip the DrawFeature callin.

Draw the unit without applying transform.

Also skips the DrawFeature callin by default so any recursion is blocked.

[source]

gl.FeatureGL4

function gl.FeatureGL4()

[source]

gl.FeatureTextures

function gl.FeatureTextures(
  featureID: integer,
  push: boolean
)

@param push - If true, push the render state; if false, pop it.

[source]

gl.FeatureShape

function gl.FeatureShape(
  featureDefID: integer,
  teamID: integer,
  rawState: boolean?,
  toScreen: boolean?,
  opaque: boolean?
)

@param rawState - (Default: true)

@param toScreen - (Default: false)

@param opaque - (Default: true) If true, draw opaque; if false, draw alpha.

[source]

gl.FeatureShapeGL4

function gl.FeatureShapeGL4()

[source]

gl.FeatureShapeTextures

function gl.FeatureShapeTextures(
  featureDefID: integer,
  push: boolean
)

@param push - If true, push the render state; if false, pop it.

[source]

gl.FeatureMultMatrix

function gl.FeatureMultMatrix(featureID: integer)

[source]

gl.FeaturePiece

function gl.FeaturePiece(
  featureID: integer,
  pieceID: integer
)

[source]

gl.FeaturePieceMatrix

function gl.FeaturePieceMatrix(
  featureID: integer,
  pieceID: integer
)

[source]

gl.FeaturePieceMultMatrix

function gl.FeaturePieceMultMatrix(
  featureID: integer,
  pieceID: integer
)

[source]

gl.DrawListAtUnit

function gl.DrawListAtUnit(
  unitID: integer,
  listIndex: integer,
  useMidPos: boolean?,
  scaleX: number?,
  scaleY: number?,
  scaleZ: number?,
  degrees: number?,
  rotX: number?,
  rotY: number?,
  rotZ: number?
)

@param useMidPos - (Default: true)

@param scaleX - (Default: 1.0)

@param scaleY - (Default: 1.0)

@param scaleZ - (Default: 1.0)

@param degrees - (Default: 0.0)

@param rotX - (Default: 0.0)

@param rotY - (Default: 1.0)

@param rotZ - (Default: 0.0)

[source]

gl.DrawFuncAtUnit

function gl.DrawFuncAtUnit(
  unitID: integer,
  useMidPos: boolean?,
  fun: unknown,
  ...: any
)

@param useMidPos - (Default: true)

@param ... - Arguments passed to function.

[source]

gl.DrawGroundCircle

function gl.DrawGroundCircle(
  posX: number,
  posY: number,
  posZ: number,
  radius: number,
  resolution: integer
)

[source]

gl.DrawGroundCircle

function gl.DrawGroundCircle(
  posX: number,
  posY: number,
  posZ: number,
  radius: number,
  resolution: integer,
  slope: number,
  gravity: number,
  weaponDefID: integer
)

[source]

gl.DrawGroundCircle

function gl.DrawGroundCircle(
  x0: number,
  z0: number,
  x1: number,
  z1: number,
  useNorm: nil,
  useTxcd: boolean?
)

@param useNorm - No longer used.

@param useTxcd - (Default: false)

[source]

gl.DrawGroundCircle

function gl.DrawGroundCircle(
  x0: number,
  z0: number,
  x1: number,
  z1: number,
  useNorm: nil,
  tu0: number,
  tv0: number,
  tu1: number,
  tv1: number
)

@param useNorm - No longer used.

[source]

gl.Shape

function gl.Shape(
  type: GL,
  vertices: VertexData[]
)

[source]

gl.BeginEnd

function gl.BeginEnd(
  primMode: GL,
  fun: unknown,
  ...: any
)

@param ... - Arguments passed to function.

[source]

gl.Vertex

function gl.Vertex(v: xy)

[source]

gl.Vertex

function gl.Vertex(v: xyz)

[source]

gl.Vertex

function gl.Vertex(v: xyzw)

[source]

gl.Vertex

function gl.Vertex(
  x: number,
  y: number,
  z: number?,
  w: number?
)

[source]

gl.Normal

function gl.Normal(v: xyz)

[source]

gl.Normal

function gl.Normal(
  x: number,
  y: number,
  z: number
)

[source]

gl.TexCoord

function gl.TexCoord(coord: (number))

[source]

gl.TexCoord

function gl.TexCoord(coord: xy)

[source]

gl.TexCoord

function gl.TexCoord(coord: xyz)

[source]

gl.TexCoord

function gl.TexCoord(coord: xyzw)

[source]

gl.TexCoord

function gl.TexCoord(
  s: number,
  t: number?,
  r: number?,
  q: number?
)

[source]

gl.MultiTexCoord

function gl.MultiTexCoord(
  texNum: integer,
  coord: (number)
)

[source]

gl.MultiTexCoord

function gl.MultiTexCoord(
  texNum: integer,
  coord: xy
)

[source]

gl.MultiTexCoord

function gl.MultiTexCoord(
  texNum: integer,
  coord: xyz
)

[source]

gl.MultiTexCoord

function gl.MultiTexCoord(
  texNum: integer,
  coord: xyzw
)

[source]

gl.MultiTexCoord

function gl.MultiTexCoord(
  texNum: integer,
  s: number,
  t: number?,
  r: number?,
  q: number?
)

[source]

gl.SecondaryColor

function gl.SecondaryColor(color: rgb)

[source]

gl.SecondaryColor

function gl.SecondaryColor(
  r: number,
  g: number,
  b: number
)

[source]

gl.FogCoord

function gl.FogCoord(coord: number)

[source]

gl.EdgeFlag

function gl.EdgeFlag(flag: boolean)

[source]

gl.Rect

function gl.Rect(
  x1: number,
  y1: number,
  x2: number,
  y2: number
)

[source]

gl.Rect

function gl.Rect(
  x1: number,
  y1: number,
  x2: number,
  y2: number,
  flipSCoords: boolean?,
  flipTCoords: boolean?
)

[source]

gl.Rect

function gl.Rect(
  x1: number,
  y1: number,
  x2: number,
  y2: number,
  s1: number,
  t1: number,
  s2: number,
  t2: number
)

[source]

gl.DispatchCompute

function gl.DispatchCompute(
  numGroupX: integer,
  numGroupY: integer,
  numGroupZ: integer,
  barriers: integer?
)

@param barriers - (Default: 4)

[source]

gl.MemoryBarrier

function gl.MemoryBarrier(barriers: integer?)

@param barriers - (Default: 4)

[source]

gl.Color

function gl.Color(
  r: number,
  g: number,
  b: number,
  a: number?
)

@param r - Red.

@param g - Green.

@param b - Blue.

@param a - (Default: 1.0) Alpha.

[source]

gl.Color

function gl.Color(color: rgba)

@param color - Color with alpha.

[source]

gl.Color

function gl.Color(color: rgb)

@param color - Color.

[source]

gl.Material

function gl.Material(material: Material)

[source]

gl.ResetState

function gl.ResetState()

[source]

gl.ResetMatrices

function gl.ResetMatrices()

[source]

gl.Lighting

function gl.Lighting(enable: boolean)

[source]

gl.ShadeModel

function gl.ShadeModel(model: GL)

[source]

gl.Scissor

function gl.Scissor(enable: boolean)

[source]

gl.Scissor

function gl.Scissor(
  x: integer,
  y: integer,
  w: integer,
  h: integer
)

[source]

gl.Viewport

function gl.Viewport(
  x: integer,
  y: integer,
  w: integer,
  h: integer
)

[source]

gl.ColorMask

function gl.ColorMask(rgba: boolean)

Enable or disable writing of frame buffer color components.

[source]

gl.ColorMask

function gl.ColorMask(
  red: boolean,
  green: boolean,
  blue: boolean,
  alpha: boolean
)

Enable or disable writing of frame buffer color components.

[source]

gl.DepthMask

function gl.DepthMask(enable: boolean)

Enable or disable writing into the depth buffer.

[source]

gl.DepthTest

function gl.DepthTest(enable: boolean)

Enable or disable depth test.

[source]

gl.DepthTest

function gl.DepthTest(depthFunction: GL)

@param depthFunction - Symbolic constants GL.NEVER, GL.LESS, GL.EQUAL, GL.LEQUAL, GL.GREATER, GL.NOTEQUAL, GL.GEQUAL, and GL.ALWAYS are accepted. The initial value is GL.LESS.

Enable depth test and specify the depth comparison function.

[source]

gl.DepthClamp

function gl.DepthClamp(enable: boolean)

[source]

gl.Culling

function gl.Culling(enable: boolean)

[source]

gl.Culling

function gl.Culling(mode: GL)

@param mode - Specifies whether front- or back-facing facets are candidates for culling. Symbolic constants GL.FRONT, GL.BACK, and GL.FRONT_AND_BACK are accepted. The initial value is GL.BACK.

Enable culling and set culling mode.

[source]

gl.LogicOp

function gl.LogicOp(enable: boolean)

[source]

gl.LogicOp

function gl.LogicOp(opCode: GL)

@param opCode - Specifies a symbolic constant that selects a logical operation. The following symbols are accepted: GL.CLEAR, GL.SET, GL.COPY, GL.COPY_INVERTED, GL.NOOP, GL.INVERT, GL.AND, GL.NAND, GL.OR, GL.NOR, GL.XOR, GL.EQUIV, GL.AND_REVERSE, GL.AND_INVERTED, GL.OR_REVERSE, and GL.OR_INVERTED. The initial value is GL.COPY.

Specify a logical pixel operation for rendering.

[source]

gl.Fog

function gl.Fog(enable: boolean)

[source]

gl.Blending

function gl.Blending(enable: boolean)

[source]

gl.Blending

function gl.Blending(mode: ("add"|"alpha_add"|"alpha"|"reset"|"color"|"modulate"|"disable"))

[source]

gl.Blending

function gl.Blending(
  src: GL,
  dst: GL
)

[source]

gl.BlendEquation

function gl.BlendEquation(mode: GL)

[source]

gl.BlendFunc

function gl.BlendFunc(
  src: GL,
  dst: GL
)

[source]

gl.BlendEquationSeparate

function gl.BlendEquationSeparate(
  modeRGB: GL,
  modeAlpha: GL
)

[source]

gl.BlendFuncSeparate

function gl.BlendFuncSeparate(
  srcRGB: GL,
  dstRGB: GL,
  srcAlpha: GL,
  dstAlpha: GL
)

[source]

gl.AlphaTest

function gl.AlphaTest(enable: boolean)

[source]

gl.AlphaTest

function gl.AlphaTest(
  func: GL,
  ref: number
)

@param func - Specifies the alpha comparison function. Symbolic constants GL.NEVER, GL.LESS, GL.EQUAL, GL.LEQUAL, GL.GREATER, GL.NOTEQUAL, GL.GEQUAL, and GL.ALWAYS are accepted. The initial value is GL.ALWAYS.

@param ref - Specifies the reference value that incoming alpha values are compared to. This value is clamped to the range [0, 1], where 0 represents the lowest possible alpha value and 1 the highest possible value. The initial reference value is 0.

Specify the alpha test function.

[source]

gl.AlphaToCoverage

function gl.AlphaToCoverage(enable: boolean)

[source]

gl.PolygonMode

function gl.PolygonMode(
  face: GL,
  mode: GL
)

@param face - Specifies the polygons that mode applies to. Must be GL.FRONT for front-facing polygons, GL.BACK for back-facing polygons, or GL.FRONT_AND_BACK for front- and back-facing polygons.

@param mode - Specifies how polygons will be rasterized. Accepted values are GL.POINT, GL.LINE, and GL.FILL. The initial value is GL.FILL for both front- and back-facing polygons.

Select polygon rasterization mode.

[source]

gl.PolygonOffset

function gl.PolygonOffset(enable: boolean)

[source]

gl.PolygonOffset

function gl.PolygonOffset(
  factor: number,
  units: number
)

@param factor - Specifies a scale factor that is used to create a variable depth offset for each polygon. The initial value is 0.

@param units - Is multiplied by an implementation-specific value to create a constant depth offset. The initial value is 0.

[source]

gl.StencilTest

function gl.StencilTest(enable: boolean)

[source]

gl.StencilMask

function gl.StencilMask(mask: integer)

@param mask - Specifies a bit mask to enable and disable writing of individual bits in the stencil planes. Initially, the mask is all 1’s.

Control the front and back writing of individual bits in the stencil planes.

[source]

gl.StencilFunc

function gl.StencilFunc(
  func: GL,
  ref: integer,
  mask: integer
)

@param func - Specifies the test function. Eight symbolic constants are valid: GL.NEVER, GL.LESS, GL.EQUAL, GL.LEQUAL, GL.GREATER, GL.NOTEQUAL, GL.GEQUAL, and GL.ALWAYS. The initial value is GL.ALWAYS.

@param ref - Specifies the reference value for the stencil test. ref is clamped to the range [0, 2^n - 1], where n is the number of bitplanes in the stencil buffer. The initial value is 0.

@param mask - Specifies a mask that is ANDed with both the reference value and the stored stencil value when the test is done. The initial value is all 1’s.

Set front and back function and reference value for stencil testing.

[source]

gl.StencilOp

function gl.StencilOp(
  fail: GL,
  zfail: GL,
  zpass: GL
)

@param fail - Specifies the action to take when the stencil test fails. Eight symbolic constants are valid: GL.KEEP, GL.ZERO, GL.REPLACE, GL.INCR, GL.INCR_WRAP, GL.DECR, GL.DECR_WRAP, and GL.INVERT. The initial value is GL.KEEP.

@param zfail - Specifies the stencil action when the stencil test passes, but the depth test fails. The initial value is GL.KEEP.

@param zpass - Specifies the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled. The initial value is GL.KEEP.

Set front and back stencil test actions.

[source]

gl.StencilMaskSeparate

function gl.StencilMaskSeparate(
  face: GL,
  mask: integer
)

@param face - Specifies whether the front and/or back stencil writemask is updated. Three symbolic constants are accepted: GL.FRONT, GL.BACK, and GL.FRONT_AND_BACK. The initial value is GL.FRONT_AND_BACK.

@param mask - Specifies a bit mask to enable and disable writing of individual bits in the stencil planes. Initially, the mask is all 1’s.

Control the front and back writing of individual bits in the stencil planes.

[source]

gl.StencilFuncSeparate

function gl.StencilFuncSeparate(
  face: GL,
  func: GL,
  ref: integer,
  mask: integer
)

@param face - Specifies whether front and/or back stencil state is updated. Three symbolic constants are accepted: GL.FRONT, GL.BACK, and GL.FRONT_AND_BACK. The initial value is GL.FRONT_AND_BACK.

@param func - Specifies the test function. Eight symbolic constants are valid: GL.NEVER, GL.LESS, GL.EQUAL, GL.LEQUAL, GL.GREATER, GL.NOTEQUAL, GL.GEQUAL, and GL.ALWAYS. The initial value is GL.ALWAYS.

@param ref - Specifies the reference value for the stencil test. ref is clamped to the range [0, 2^n - 1], where n is the number of bitplanes in the stencil buffer. The initial value is 0.

@param mask - Specifies a mask that is ANDed with both the reference value and the stored stencil value when the test is done. The initial value is all 1’s.

Set front and/or back function and reference value for stencil testing.

[source]

gl.StencilOpSeparate

function gl.StencilOpSeparate(
  face: GL,
  fail: GL,
  zfail: GL,
  zpass: GL
)

@param face - Specifies whether front and/or back stencil state is updated. Three symbolic constants are accepted: GL.FRONT, GL.BACK, and GL.FRONT_AND_BACK. The initial value is GL.FRONT_AND_BACK.

@param fail - Specifies the action to take when the stencil test fails. Eight symbolic constants are valid: GL.KEEP, GL.ZERO, GL.REPLACE, GL.INCR, GL.INCR_WRAP, GL.DECR, GL.DECR_WRAP, and GL.INVERT. The initial value is GL.KEEP.

@param zfail - Specifies the stencil action when the stencil test passes, but the depth test fails. The initial value is GL.KEEP.

@param zpass - Specifies the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled. The initial value is GL.KEEP.

Set front and/or back stencil test actions.

[source]

gl.LineStipple

function gl.LineStipple(enable: boolean)

[source]

gl.LineStipple

function gl.LineStipple(ignoredString: string)

@param ignoredString - The value of this string is ignored, but it still does something.

[source]

gl.LineStipple

function gl.LineStipple(
  factor: integer,
  pattern: integer,
  shift: integer?
)

[source]

gl.LineWidth

function gl.LineWidth(width: number)

[source]

gl.PointSize

function gl.PointSize(size: number)

[source]

gl.PointSprite

function gl.PointSprite(
  enable: boolean,
  enableCoordReplace: boolean?,
  coordOrigin: boolean?
)

@param coordOrigin - true for upper left, false for lower left, otherwise no change.

[source]

gl.PointParameter

function gl.PointParameter(
  atten0: number,
  atten1: number,
  atten2: number,
  sizeMin: number?,
  sizeMax: number?,
  sizeFade: number?
)

[source]

gl.Texture

function gl.Texture(
  texNum: integer,
  enable: boolean?
) ->  boolean

[source]

gl.Texture

function gl.Texture(enable: boolean) ->  boolean

[source]

gl.Texture

function gl.Texture(
  texNum: integer,
  image: string
) ->  boolean

[source]

gl.Texture

function gl.Texture(image: string) ->  boolean

[source]

gl.CreateTexture

function gl.CreateTexture(
  xsize: integer,
  ysize: integer,
  texture: Texture
) -> texName string?

[source]

gl.CreateTexture

function gl.CreateTexture(
  xsize: integer,
  ysize: integer,
  zsize: integer,
  texture: Texture
) -> texName string?

[source]

gl.ChangeTextureParams

function gl.ChangeTextureParams(
  texName: string,
  params: Texture
)

[source]

gl.DeleteTexture

function gl.DeleteTexture(texName: string) ->  boolean

[source]

gl.DeleteTextureFBO

function gl.DeleteTextureFBO(texName: string) ->  boolean

[source]

gl.TextureInfo

function gl.TextureInfo(texName: string) -> textureInfo TextureInfo

[source]

gl.CopyToTexture

function gl.CopyToTexture(
  texName: string,
  xoff: integer,
  yoff: integer,
  x: integer,
  y: integer,
  w: integer,
  h: integer,
  target: GL?,
  level: GL?
)

[source]

gl.RenderToTexture

function gl.RenderToTexture(
  texName: string,
  fun: unknown,
  ...: any
)

@param ... - Arguments to the function.

[source]

gl.GenerateMipmap

function gl.GenerateMipmap(texName: string)

[source]

gl.ActiveTexture

function gl.ActiveTexture(
  texNum: integer,
  func: function,
  ...: any
)

@param ... - Arguments to the function.

[source]

gl.TextEnv

function gl.TextEnv(
  target: GL,
  pname: GL,
  value: number
)

[source]

gl.TextEnv

function gl.TextEnv(
  target: GL,
  pname: GL,
  r: number?,
  g: number?,
  b: number?,
  a: number?
)

@param r - (Default: 0.0)

@param g - (Default: 0.0)

@param b - (Default: 0.0)

@param a - (Default: 0.0)

[source]

gl.MultiTexEnv

function gl.MultiTexEnv(
  texNum: integer,
  target: GL,
  pname: GL,
  value: number
)

[source]

gl.MultiTexEnv

function gl.MultiTexEnv(
  texNum: integer,
  target: GL,
  pname: GL,
  r: number?,
  g: number?,
  b: number?,
  a: number?
)

@param r - (Default: 0.0)

@param g - (Default: 0.0)

@param b - (Default: 0.0)

@param a - (Default: 0.0)

[source]

gl.TexGen

function gl.TexGen(
  target: GL,
  state: boolean
)

[source]

gl.TexGen

function gl.TexGen(
  target: GL,
  pname: GL,
  value: number
)

[source]

gl.TexGen

function gl.TexGen(
  target: GL,
  pname: GL,
  r: number?,
  g: number?,
  b: number?,
  a: number?
)

@param r - (Default: 0.0)

@param g - (Default: 0.0)

@param b - (Default: 0.0)

@param a - (Default: 0.0)

[source]

gl.MultiTexGen

function gl.MultiTexGen(
  texNum: integer,
  target: GL,
  state: boolean
)

[source]

gl.MultiTexGen

function gl.MultiTexGen(
  texNum: integer,
  target: GL,
  pname: GL,
  value: number
)

[source]

gl.MultiTexGen

function gl.MultiTexGen(
  texNum: integer,
  target: GL,
  pname: GL,
  r: number?,
  g: number?,
  b: number?,
  a: number?
)

@param r - (Default: 0.0)

@param g - (Default: 0.0)

@param b - (Default: 0.0)

@param a - (Default: 0.0)

[source]

gl.BindImageTexture

function gl.BindImageTexture(
  unit: integer,
  texID: string?,
  level: integer?,
  layer: integer?,
  access: integer?,
  format: integer?
)

[source]

gl.CreateTextureAtlas

function gl.CreateTextureAtlas(
  xsize: integer,
  ysize: integer,
  allocType: integer?
) -> texName string

[source]

gl.FinalizeTextureAtlas

function gl.FinalizeTextureAtlas(texName: string) ->  boolean

[source]

gl.DeleteTextureAtlas

function gl.DeleteTextureAtlas(texName: string) ->  boolean

[source]

gl.AddAtlasTexture

function gl.AddAtlasTexture(
  texName: string,
  subAtlasTexName: string
)

[source]

gl.GetAtlasTexture

function gl.GetAtlasTexture(
  texName: string,
  subAtlasTexName: string
)
 -> x1 number
 -> x2 number
 -> y1 number
 -> y2 number

[source]

gl.GetEngineAtlasTextures

function gl.GetEngineAtlasTextures(atlasName: ("$explosions"|"$groundfx")) -> atlasTextures table<string,float4>

@return atlasTextures - Table of x1,x2,y1,y2 coordinates by texture name.

[source]

gl.Clear

function gl.Clear(
  bits: GL,
  val: number
)

@param bits - GL.DEPTH_BUFFER_BIT or GL.STENCIL_BUFFER_BIT.

[source]

gl.Clear

function gl.Clear(
  bits: GL,
  r: number,
  g: number,
  b: number,
  a: number
)

@param bits - GL.COLOR_BUFFER_BIT or GL.ACCUM_BUFFER_BIT.

[source]

gl.SwapBuffers

function gl.SwapBuffers()

[source]

gl.Translate

function gl.Translate(
  x: number,
  y: number,
  z: number
)

[source]

gl.Scale

function gl.Scale(
  x: number,
  y: number,
  z: number
)

[source]

gl.Rotate

function gl.Rotate(
  r: number,
  x: number,
  y: number,
  z: number
)

[source]

gl.Ortho

function gl.Ortho(
  left: number,
  right: number,
  bottom: number,
  top: number,
  near: number,
  far: number
)

[source]

gl.Frustum

function gl.Frustum(
  left: number,
  right: number,
  bottom: number,
  top: number,
  near: number,
  far: number
)

[source]

gl.Billboard

function gl.Billboard()

[source]

gl.Light

function gl.Light(
  light: integer,
  enable: boolean
)

[source]

gl.Light

function gl.Light(
  light: integer,
  pname: GL,
  param: GL
)

[source]

gl.Light

function gl.Light(
  light: integer,
  pname: GL,
  r: number,
  g: number,
  b: number,
  a: number?
)

[source]

gl.ClipPlane

function gl.ClipPlane(
  plane: integer,
  enable: boolean
)

[source]

gl.ClipPlane

function gl.ClipPlane(
  plane: integer,
  equation0: number,
  equation1: number,
  equation2: number,
  equation3: number
)

[source]

gl.ClipDistance

function gl.ClipDistance(
  clipId: integer,
  enable: boolean
)

[source]

gl.MatrixMode

function gl.MatrixMode(mode: GL)

[source]

gl.LoadIdentity

function gl.LoadIdentity()

[source]

gl.LoadMatrix

function gl.LoadMatrix(matrix: string)

[source]

gl.LoadMatrix

function gl.LoadMatrix(matrix: Matrix4x4)

[source]

gl.LoadMatrix

function gl.LoadMatrix()
 -> m11 number
 -> m12 number
 -> m13 number
 -> m14 number
 -> m21 number
 -> m22 number
 -> m23 number
 -> m24 number
 -> m31 number
 -> m32 number
 -> m33 number
 -> m34 number
 -> m41 number
 -> m42 number
 -> m43 number
 -> m44 number

[source]

gl.MultMatrix

function gl.MultMatrix(matrixName: string)

[source]

gl.MultMatrix

function gl.MultMatrix(matrix: Matrix4x4)

[source]

gl.MultMatrix

function gl.MultMatrix(
  m11: number,
  m12: number,
  m13: number,
  m14: number,
  m21: number,
  m22: number,
  m23: number,
  m24: number,
  m31: number,
  m32: number,
  m33: number,
  m34: number,
  m41: number,
  m42: number,
  m43: number,
  m44: number
)

[source]

gl.PushMatrix

function gl.PushMatrix()

[source]

gl.PopMatrix

function gl.PopMatrix()

[source]

gl.PushPopMatrix

function gl.PushPopMatrix(
  matMode1: GL,
  func: fun(),
  ...: any
)

@param ... - Arguments to the function.

[source]

gl.PushPopMatrix

function gl.PushPopMatrix(
  func: fun(),
  ...: any
)

@param ... - Arguments to the function.

[source]

gl.GetMatrixData

function gl.GetMatrixData(
  type: GL,
  index: integer
) -> The number

@param type - Matrix type (GL.PROJECTION, GL.MODELVIEW, GL.TEXTURE).

@param index - Matrix index in range [1, 16].

@return The - value.

Get value at index of matrix.

[source]

gl.GetMatrixData

function gl.GetMatrixData(type: GL) -> The Matrix4x4

@param type - Matrix type (GL.PROJECTION, GL.MODELVIEW, GL.TEXTURE).

@return The - matrix.

[source]

gl.GetMatrixData

function gl.GetMatrixData(index: integer) -> The number

@param index - Matrix index in range [1, 16].

@return The - value.

[source]

gl.GetMatrixData

function gl.GetMatrixData(name: MatrixName) -> The Matrix4x4

@param name - The matrix name.

@return The - matrix.

[source]

gl.PushAttrib

function gl.PushAttrib(mask: GL?)

@param mask - (Default: GL.ALL_ATTRIB_BITS)

[source]

gl.PopAttrib

function gl.PopAttrib()

[source]

gl.UnsafeState

function gl.UnsafeState(
  state: GL,
  func: fun(),
  ...: any
)

@param ... - Arguments to the function.

[source]

gl.UnsafeState

function gl.UnsafeState(
  state: GL,
  reverse: boolean,
  func: fun(),
  ...: any
)

@param ... - Arguments to the function.

[source]

gl.GetFixedState

function gl.GetFixedState(
  param: string,
  toStr: boolean?
)
 -> enabled boolean
 -> values any...

@param toStr - (Default: false)

[source]

gl.CreateList

function gl.CreateList(
  func: fun(),
  ...: any
)

@param ... - Arguments to the function.

[source]

gl.CallList

function gl.CallList(listIndex: integer)

[source]

gl.DeleteList

function gl.DeleteList(listIndex: integer)

[source]

gl.Flush

function gl.Flush()

[source]

gl.Finish

function gl.Finish()

[source]

gl.ReadPixels

function gl.ReadPixels(
  x: integer,
  y: integer,
  w: 1,
  h: 1,
  format: GL?
) -> Color number...

@param format - (Default: GL.RGBA)

@return Color - values (color size based on format).

Get single pixel.

[source]

gl.ReadPixels

function gl.ReadPixels(
  x: integer,
  y: integer,
  w: 1,
  h: integer,
  format: GL?
) -> Column number[][]

@param format - (Default: GL.RGBA)

@return Column - of color values (color size based on format).

Get column of pixels.

[source]

gl.ReadPixels

function gl.ReadPixels(
  x: integer,
  y: integer,
  w: integer,
  h: 1,
  format: GL?
) -> Row number[][]

@param format - (Default: GL.RGBA)

@return Row - of color values (color size based on format).

Get row of pixels.

[source]

gl.ReadPixels

function gl.ReadPixels(
  x: integer,
  y: integer,
  w: integer,
  h: integer,
  format: GL?
) -> Array number[][][]

@param format - (Default: GL.RGBA)

@return Array - of columns of color values (color size based on format).

Get row of pixels.

[source]

gl.SaveImage

function gl.SaveImage(
  x: integer,
  y: integer,
  width: integer,
  height: integer,
  filename: string,
  options: SaveImageOptions?
) -> success boolean?

[source]

gl.CreateQuery

function gl.CreateQuery() -> query any

[source]

gl.DeleteQuery

function gl.DeleteQuery(query: any)

[source]

gl.RunQuery

function gl.RunQuery(query: any)

[source]

gl.GetQuery

function gl.GetQuery(query: any) -> count integer

[source]

gl.GetGlobalTexNames

function gl.GetGlobalTexNames() -> List string[]

@return List - of texture names.

[source]

gl.GetGlobalTexCoords

function gl.GetGlobalTexCoords()
 -> xstart number
 -> ystart number
 -> xend number
 -> yend number

[source]

gl.GetShadowMapParams

function gl.GetShadowMapParams()
 -> x number
 -> y number
 -> z number
 -> w number

[source]

gl.GetAtmosphere

function gl.GetAtmosphere()
 -> lightDirX number
 -> lightDirY number
 -> lightDirZ number

[source]

gl.GetAtmosphere

function gl.GetAtmosphere(param: ("fogStart"|"fogEnd"|"pos"|"fogColor"|"skyColor"|"sunColor"|"cloudColor"|"skyAxisAngle")) ->  any...

[source]

gl.GetSun

function gl.GetSun()
 -> lightDirX number
 -> lightDirY number
 -> lightDirZ number

[source]

gl.GetSun

function gl.GetSun(
  param: ("pos"|"dir"|"specularExponent"|"shadowDensity"|"diffuse"|"ambient"|"specular"),
  mode: ("ground"|"unit")
)
 -> data1 number?
 -> data2 number?
 -> data3 number?

@param mode - (Default: "ground")

[source]

gl.GetWaterRendering

function gl.GetWaterRendering(key: string) -> value any...

[source]

gl.GetMapRendering

function gl.GetMapRendering(key: string) -> value any...

[source]

gl.ObjectLabel

function gl.ObjectLabel(
  objectTypeIdentifier: GL,
  objectID: integer,
  label: string
)

@param objectTypeIdentifier - Specifies the type of object being labeled.

@param objectID - Specifies the name or ID of the object to label.

@param label - A string containing the label to be assigned to the object.

Labels an object for use with debugging tools.

[source]

gl.PushDebugGroup

function gl.PushDebugGroup(
  id: integer,
  message: string,
  sourceIsThirdParty: boolean
) ->  nil

@param id - A numeric identifier for the group.

@param message - A human-readable string describing the debug group.

@param sourceIsThirdParty - Set the source tag, true for GL_DEBUG_SOURCE_THIRD_PARTY, false for GL_DEBUG_SOURCE_APPLICATION. default false

Pushes a debug marker for nVidia nSight 2024.04, does not seem to work when FBO’s are raw bound.

[source]

gl.PopDebugGroup

function gl.PopDebugGroup() ->  nil

[source]

gl.CreateRBO

function gl.CreateRBO(
  xsize: integer,
  ysize: integer,
  data: CreateRBOData
) ->  RBO

[source]

gl.DeleteRBO

function gl.DeleteRBO(rbo: RBO)

[source]

gl.GetVAO

function gl.GetVAO() -> vao VAO?

@return vao - The VAO ref on success, else nil

Example:

local myVAO = gl.GetVAO()
if myVAO == nil then Spring.Echo("Failed to get VAO") end

[source]

gl.AddFallbackFont

function gl.AddFallbackFont(filePath: string) -> success boolean

@param filePath - VFS path to the file, for example “fonts/myfont.ttf”. Uses VFS.RAW_FIRST access mode.

Adds a fallback font for the font rendering engine.

Fonts added first will have higher priority. When a glyph isn’t found when rendering a font, the fallback fonts will be searched first, otherwise os fonts will be used.

The application should listen for the unsynced ‘FontsChanged’ callin so modules can clear any already reserved display lists or other relevant caches.

Note the callin won’t be executed at the time of calling this method, but later, on the Update cycle (before other Update and Draw callins).

[source]

gl.ClearFallbackFonts

function gl.ClearFallbackFonts() ->  nil

Clears all fallback fonts.

See the note at ‘AddFallbackFont’ about the ‘FontsChanged’ callin, it also applies when calling this method.

[source]

gl.CreateFBO

function gl.CreateFBO(fboDesc: FBODescription) -> fbo FBO

[source]

gl.DeleteFBO

function gl.DeleteFBO(fbo: FBO)

This doesn’t delete the attached objects!

[source]

gl.IsValidFBO

function gl.IsValidFBO(
  fbo: FBO,
  target: GL?
)
 -> valid boolean
 -> status number?

[source]

gl.ActiveFBO

function gl.ActiveFBO(
  fbo: FBO,
  func: fun(...),
  ...: any
)

@param ... - args

[source]

gl.ActiveFBO

function gl.ActiveFBO(
  fbo: FBO,
  target: GL?,
  func: fun(...),
  ...: any
)

@param ... - args

[source]

gl.RawBindFBO

function gl.RawBindFBO(
  fbo: nil,
  target: GL?,
  rawFboId: integer?
) ->  nil

@param target - (Default: GL_FRAMEBUFFER_EXT)

@param rawFboId - (Default: 0)

Bind default or specified via rawFboId numeric id of FBO

[source]

gl.RawBindFBO

function gl.RawBindFBO(
  fbo: FBO,
  target: GL?
) -> previouslyBoundRawFboId number

@param target - (Default: fbo.target)

[source]

gl.BlitFBO

function gl.BlitFBO(
  x0Src: number,
  y0Src: number,
  x1Src: number,
  y1Src: number,
  x0Dst: number,
  y0Dst: number,
  x1Dst: number,
  y1Dst: number,
  mask: number?,
  filter: number?
)

@param mask - (Default: GL_COLOR_BUFFER_BIT)

@param filter - (Default: GL_NEAREST)

needs GLAD_GL_EXT_framebuffer_blit

[source]

gl.BlitFBO

function gl.BlitFBO(
  fboSrc: FBO,
  x0Src: number,
  y0Src: number,
  x1Src: number,
  y1Src: number,
  fboDst: FBO,
  x0Dst: number,
  y0Dst: number,
  x1Dst: number,
  y1Dst: number,
  mask: number?,
  filter: number?
)

@param mask - (Default: GL_COLOR_BUFFER_BIT)

@param filter - (Default: GL_NEAREST)

needs GLAD_GL_EXT_framebuffer_blit

[source]

gl.ClearAttachmentFBO

function gl.ClearAttachmentFBO(
  target: number?,
  attachment: (GL|Attachment),
  clearValue0: number?,
  clearValue1: number?,
  clearValue2: number?,
  clearValue3: number?
) -> success boolean

@param target - (Default: GL.FRAMEBUFFER)

@param attachment - (e.g. "color0" or GL.COLOR_ATTACHMENT0)

@param clearValue0 - (Default: 0)

@param clearValue1 - (Default: 0)

@param clearValue2 - (Default: 0)

@param clearValue3 - (Default: 0)

needs Platform.glVersionNum >= 30 Clears the “attachment” of the currently bound FBO type “target” with “clearValues”

[source]

gl.GetShaderLog

function gl.GetShaderLog() -> infoLog string

Returns the shader compilation error log. This is empty if the shader linking failed, in that case, check your in/out blocks and ensure they match.

[source]

gl.CreateShader

function gl.CreateShader(shaderParams: ShaderParams) -> shaderID integer

Create a shader.

[source]

gl.DeleteShader

function gl.DeleteShader(shaderID: integer)

Deletes a shader identified by shaderID

[source]

gl.UseShader

function gl.UseShader(shaderID: integer) -> linked boolean

Binds a shader program identified by shaderID. Pass 0 to disable the shader. Returns whether the shader was successfully bound.

[source]

gl.ActiveShader

function gl.ActiveShader(
  shaderID: integer,
  func: function,
  ...: any
)

@param ... - Arguments

Binds a shader program identified by shaderID, and calls the Lua func with the specified arguments.

Can be used in NON-drawing events (to update uniforms etc.)!

[source]

gl.GetActiveUniforms

function gl.GetActiveUniforms(shaderID: integer) -> activeUniforms ActiveUniform[]

Query the active (actually used) uniforms of a shader and identify their names, types (float, int, uint) and sizes (float, vec4, …).

[source]

gl.GetUniformLocation

function gl.GetUniformLocation(
  shaderID: integer,
  name: string
) -> locationID GL

Returns the locationID of a shaders uniform. Needed for changing uniform values with function gl.Uniform.

[source]

gl.Uniform

function gl.Uniform(
  locationID: (GL|string),
  f1: number,
  f2: number?,
  f3: number?,
  f4: number?
)

@param locationID - uniformName

Sets the uniform float value at the locationID for the currently active shader. Shader must be activated before setting uniforms.

[source]

gl.UniformInt

function gl.UniformInt(
  locationID: (integer|string),
  int1: integer,
  int2: integer?,
  int3: integer?,
  int4: integer?
)

@param locationID - uniformName

Sets the uniform int value at the locationID for the currently active shader. Shader must be activated before setting uniforms.

[source]

gl.UniformArray

function gl.UniformArray(
  locationID: (integer|string),
  type: UniformArrayType,
  uniforms: number[]
)

@param locationID - uniformName

@param uniforms - Array up to 1024 elements

Sets the an array of uniform values at the locationID for the currently active shader.

Shader must be activated before setting uniforms.

[source]

gl.UniformMatrix

function gl.UniformMatrix(
  locationID: (integer|string),
  matrix: ("shadows"|"camera"|"caminv"|"camprj")
)

@param locationID - uniformName

@param matrix - Name of common matrix.

Sets the a uniform mat4 locationID for the currently active shader.

Shader must be activated before setting uniforms.

Can set one one common matrix like shadow, or by passing 16 additional numbers for the matrix.

[source]

gl.UniformMatrix

function gl.UniformMatrix(
  locationID: (number|string),
  matrix: number[]
)

@param locationID - uniformName

@param matrix - A 2x2, 3x3 or 4x4 matrix.

Sets the a uniform mat4 locationID for the currently active shader.

Shader must be activated before setting uniforms.

Can set one one common matrix like shadow, or by passing 16 additional numbers for the matrix.

[source]

gl.GetEngineUniformBufferDef

function gl.GetEngineUniformBufferDef(index: number) -> glslDefinition string

[source]

Return the GLSL compliant definition of UniformMatricesBuffer(idx=0) or UniformParamsBuffer(idx=1) structure.

gl.GetEngineModelUniformDataDef

function gl.GetEngineModelUniformDataDef(index: number) -> glslDefinition string

[source]

Return the GLSL compliant definition of ModelUniformData structure (per Unit/Feature buffer available on GPU)

gl.SetGeometryShaderParameter

function gl.SetGeometryShaderParameter(
  shaderID: integer,
  param: number,
  number: number
) ->  nil

Sets the Geometry shader parameters for shaderID. Needed by geometry shader programs (check the opengl GL_ARB_geometry_shader4 extension for glProgramParameteri)

[source]

gl.SetTesselationShaderParameter

function gl.SetTesselationShaderParameter(
  param: integer,
  value: integer
) ->  nil

Sets the tesselation shader parameters for shaderID.

Needed by tesselation shader programs. (Check the opengl GL_ARB_tessellation_shader extension for glProgramParameteri).

[source]

gl.GetVBO

function gl.GetVBO(
  bufferType: GLBufferType?,
  freqUpdated: boolean?
) -> VBO VBO?

@param bufferType - (Default: GL.ARRAY_BUFFER)

Use GL.ARRAY_BUFFER for vertex data and GL.ELEMENT_ARRAY_BUFFER for vertex indices.

@param freqUpdated - (Default: true)

true to updated frequently, false to update only once.

@return VBO - The VBO ref on success, or nil if not supported or an error occurred.

Example:

local myVBO = gl.GetVBO()
if myVBO == nil then Spring.Echo("Failed to get VBO") end

[source] See: GL.OpenGL_Buffer_Types