Libraries.Game.Graphics.DesktopGraphics Documentation

The GraphicsManager class represents a Quorum interface with OpenGL in order to draw on the screen. This is used internally by the Game class, and most users will not need to interact with this class directly.

Inherits from: Libraries.Game.Graphics.GraphicsManager, Libraries.Language.Object

Actions Documentation

AttachShader(integer programID, integer shaderID)

This action attaches a shader onto an unlinked shader program.

Parameters

  • integer programID
  • integer shaderID

BindBuffer(integer purpose, integer bufferID)

This action activates a buffer and indicates what it should be used for. The first parameter is a code, such as GL_ARRAY_BUFFER, that indicates the purpose of the buffer, and the second is an ID generated by "CreateBuffer".

Parameters

  • integer purpose: A code representing what this buffer will be used for.
  • integer bufferID: An ID representing the buffer that should be activated.

BindVertexArray(integer arrayID)

Parameters

  • integer arrayID

ClearScreen(integer mask)

This action clears the screen with the currently stored color in OpenGL.

Parameters

  • integer mask

ClearScreenColor(number red, number green, number blue, number alpha)

This action sets the color to clear the screen with in OpenGL.

Parameters

  • number red
  • number green
  • number blue
  • number alpha

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

CompileShader(integer shaderID)

This action compiles a shader, identified by its ID number. The shader must have already had its source code set using SetShaderCode.

Parameters

  • integer shaderID

CreateBuffer()

This action returns an ID for a new buffer in the rendering system. Buffers are used to relay information from the program to the graphics card. For example, they are used by VertexBufferObjects to communicate polygons and their associated info so they can be rendered. Before a buffer created by this action can be used, it has to be activated first with BindBuffer.

Return

integer: An ID associated with a new buffer.

CreateShader(integer shaderType, text sourceCode, text shaderName)

This action makes a new shader of the requested type (e.g., FRAGMENT_SHADER or VERTEX_SHADER from the Shader class) using the given source code. If the shader code successfully compiles, this action will return an integer ID representing that shader. If the shader can't be created or it does not successfully compile, this will alert an error.

Parameters

  • integer shaderType
  • text sourceCode
  • text shaderName

Return

integer:

CreateShaderID(integer shaderType)

This action gets an ID value for a new shader of the requested type (such as FRAGMENT_SHADER from Shader).

Parameters

  • integer shaderType

Return

integer:

CreateShaderProgram(Libraries.Game.Graphics.Shaders.ShaderProgram program)

CreateShaderProgramID()

This action returns an integer ID representing a new shader program in the graphics system.

Return

integer:

CreateVertexArray()

Return

integer:

DeleteBuffer(integer bufferID)

This action deletes a buffer in the rendering system. The ID provided should be an ID that was generated using CreateBuffer.

Parameters

  • integer bufferID: An ID representing the buffer to be deleted.

DeleteShader(integer shaderID)

This action instructs the rendering system to delete the native resources allocated to a shader. After deleting a shader, it can't be used by the rendering system unless it's recompiled.

Parameters

  • integer shaderID

DeleteShaderProgram(integer programID)

This action instructs the rendering system to delete the native resources allocated to a shader program. After deleting a shader program, it can't be used by the rendering system unless it's reloaded. Deleting a program doesn't automatically delete the shaders attached to it -- those must also be deleted manually.

Parameters

  • integer programID

DeleteVertexArray(integer arrayID)

This action makes a new shader of the requested type (e.g., FRAGMENT_SHADER or VERTEX_SHADER from the Shader class) using the given source code. If the shader code successfully compiles, this action will return an integer ID representing that shader. If the shader can't be created or it does not successfully compile, this will alert an error.

Parameters

  • integer arrayID

DisableProperty(integer property)

This action disables a rendering property in the native rendering system. Any property which can be enabled by EnableProperty can also be disabled using this action.

Parameters

  • integer property

DisableVertexInput(integer inputID)

This action will disable a vertex input within the shader system. Whenever a polygon is sent to the rendering system, each vertex must provide input data for each enabled vertex input.

Parameters

  • integer inputID: An ID that identifies a particular vertex input.

DrawBuffer(integer primitiveType, integer offset, integer count)

This action sends information stored in the active GL_ARRAY_BUFFER to be drawn by the rendering system.

Parameters

  • integer primitiveType
  • integer offset
  • integer count

DrawIndexedBuffer(integer primitiveType, integer count, integer indexType, integer indicesOffset)

This action renders the vertices stored in the active GL_ARRAY_BUFFER, using the indices stored in the GL_ELEMENTS_ARRAY_BUFFER to determine the order of rendering.

Parameters

  • integer primitiveType
  • integer count
  • integer indexType
  • integer indicesOffset

EnableProperty(integer property)

This action enables a rendering property in the native rendering system. For example, enabling GL_BLEND will make OpenGL blend together pixel fragments (necessary for proper transparency).

Parameters

  • integer property

EnableVertexInput(integer inputID)

This action will enable a vertex input within the shader system. Whenever a polygon is sent to the rendering system, each vertex must provide input data for each enabled vertex input.

Parameters

  • integer inputID: An ID that identifies a particular vertex input.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetGraphicsErrorCode()

This action takes the ID of a compiled shader program and 3 empty HashTables. All three HashTables will be given the names of the uniforms as keys, and the HashTables will store a corresponding integer value representing the uniform's location ID, byte size, or type ID (as an OpenGL constant), respectively. This action also returns an array containing all of the names of the uniforms in this program.

Return

integer:

GetGraphicsErrorMessages()

Return

text

GetGraphicsInteger(integer code)

Parameters

  • integer code

Return

integer

GetGraphicsText(integer code)

Parameters

  • integer code

Return

text

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetMaxTextureUnits()

This action returns the maximum number of textures that can be supported on the system. This number depends on the local hardware being used.

Return

integer:

GetShaderInputCount(integer programID)

This action returns the number of "ShaderInput" variables in a linked program. A uniform is a variable provided to a shader which is the same no matter what the shader is processing (e.g., it is the same value for every vertex in a vertex shader or for every fragment in a fragment shader).

Parameters

  • integer programID

Return

integer:

GetShaderInputInformation(integer programID, integer index, Libraries.Language.Types.Integer location, Libraries.Language.Types.Integer size, Libraries.Language.Types.Integer type)

This action queries the rendering system for information about a uniform in the provided program. This will get the uniform at the given index and returns its internal location ID, size in bytes and its type (as identified by an OpenGL constant), using the provided Integer parameters to return the information. This will also directly return the name of the uniform.

Parameters

Return

text:

GetShaderInputTables(integer programID, Libraries.Containers.HashTable<text:integer> locations, Libraries.Containers.HashTable<text:integer> sizes, Libraries.Containers.HashTable<text:integer> types)

This action takes the ID of a compiled shader program and 3 empty HashTables. All three HashTables will be given the names of the uniforms as keys, and the HashTables will store a corresponding integer value representing the uniform's location ID, byte size, or type ID (as an OpenGL constant), respectively. This action also returns an array containing all of the names of the uniforms in this program.

Parameters

Return

Libraries.Containers.Array:

GetShaderLog(integer shaderID)

This action returns log information for the given shader, or the empty string if no log information is available. Typically this is used to get error information from a shader.

Parameters

  • integer shaderID

Return

text:

GetShaderProgramLog(integer programID)

This action returns log information for a shader program, or the empty string if no log information is available. Typically this is used to get error information from a shader program.

Parameters

  • integer programID

Return

text:

GetVertexInputCount(integer programID)

This action returns the number of input variables in a linked program.

Parameters

  • integer programID

Return

integer:

GetVertexInputInformation(integer programID, integer index, Libraries.Language.Types.Integer location, Libraries.Language.Types.Integer size, Libraries.Language.Types.Integer type)

This action queries the rendering system for information about an input in the provided program. This will get the input at the given index and returns its internal location ID, size in bytes and its type (as identified by an OpenGL constant), using the provided Integer parameters to return the information. This will also directly return the name of the input.

Parameters

Return

text:

GetVertexInputTables(integer programID, Libraries.Containers.HashTable<text:integer> locations, Libraries.Containers.HashTable<text:integer> sizes, Libraries.Containers.HashTable<text:integer> types)

This action takes the ID of a compiled shader program and 3 empty HashTables. All three HashTables will be given the names of the inputs as keys, and the HashTables will store a corresponding integer value representing the input's location ID, byte size, or type ID (as an OpenGL constant), respectively. This action also returns an array containing all of the names of the inputs in this program.

Parameters

Return

Libraries.Containers.Array:

GetViewportHeight()

Return

integer

GetViewportWidth()

Return

integer

GetViewportX()

Return

integer

GetViewportY()

Return

integer

IsShaderCompiled(integer shaderID)

This action returns true if the given shader has been compiled, or false if the shader has not compiled (or if compilation was attempted but failed due to an error).

Parameters

  • integer shaderID

Return

boolean:

IsShaderProgramLinked(integer programID)

This action returns true if the given shader program has been linked, or false if the shader has not been linked (or if linking was attempted but failed due to an error).

Parameters

  • integer programID

Return

boolean:

LinkShaderProgram(integer programID)

This action links together the shaders that have been attached to the given shader program.

Parameters

  • integer programID

PixelStorageMode(integer type, integer parameter)

Sets how OpenGL stores and loads pixels as a number of bytes.

Parameters

  • integer type
  • integer parameter

SetActiveTextureID(integer id)

This action sets the "active texture" within the rendering system. When using other texture-modifying graphics commands that don't explicitly use a specific texture, the modifications will apply to the active texture.

Parameters

  • integer id

SetBlendFunction(integer sourceFunction, integer destinationFunction)

This action sets the blending function used by the rendering system. This is most commonly used for transparency calculations.

Parameters

  • integer sourceFunction
  • integer destinationFunction

SetBuffer(integer purpose, Libraries.Game.Graphics.Integer32BitBuffer buffer, integer option)

This action sets the data that is stored in the currently activated buffer (using the BindBuffer action).

Parameters

  • integer purpose: A code representing the purpose of the buffer, such as GL_ARRAY_BUFFER.
  • Libraries.Game.Graphics.Integer32BitBuffer: The data to be stored in the buffer.
  • integer option: A code representing a context-specific option, such as GL_STATIC_DRAW for GL_ARRAY_BUFFER data.

SetBuffer(integer purpose, Libraries.Game.Graphics.Number32BitBuffer buffer, integer option)

This action sets the data that is stored in the currently activated buffer (using the BindBuffer action).

Parameters

  • integer purpose: A code representing the purpose of the buffer, such as GL_ARRAY_BUFFER.
  • Libraries.Game.Graphics.Number32BitBuffer: The data to be stored in the buffer.
  • integer option: A code representing a context-specific option, such as GL_STATIC_DRAW for GL_ARRAY_BUFFER data.

SetCullFace(integer face)

This action determines which faces of objects should be culled by the rendering system. Most commonly, this is set to GL_BACK, which instructs the rendering system not to render back faces of objects (which would face away from the camera).

Parameters

  • integer face

SetDefaultVertexValue(integer location, number x)

Parameters

  • integer location
  • number x

SetDefaultVertexValue(integer location, number x, number y, number z, number w)

Parameters

  • integer location
  • number x
  • number y
  • number z
  • number w

SetDefaultVertexValue(integer location, number x, number y)

Parameters

  • integer location
  • number x
  • number y

SetDefaultVertexValue(integer location, number x, number y, number z)

Parameters

  • integer location
  • number x
  • number y
  • number z

SetDepthFunction(integer function)

This action sets the function used to determine if a new value should overwrite an old value in the depth buffer. For example, a value of GL_LESS ensures that new values will overwrite old values in the depth buffer if they have a lower relative Z value than the previous value.

Parameters

  • integer function

SetDepthMask(boolean mask)

This action enables or disables writing to the depth buffer.

Parameters

  • boolean mask

SetDepthRange(number near, number far)

This action takes a range of values between 0 and 1 to indicate how much of the depth buffer should be used. Most commonly, this is set to 0 and 1 for the near and far values, respectively, which indicate that the entire range of the depth buffer should be used.

Parameters

  • number near
  • number far

SetDrawingRegion(integer x, integer y, integer width, integer height)

This action sets how OpenGL interprets virtual coordinates into screen coordinates, by setting the screen as though it were at the given virtual coordinates with the given width and height.

Parameters

  • integer x
  • integer y
  • integer width
  • integer height

SetPixelClipping(integer x, integer y, integer width, integer height)

This action takes the ID of a compiled shader program and 3 empty HashTables. All three HashTables will be given the names of the inputs as keys, and the HashTables will store a corresponding integer value representing the input's location ID, byte size, or type ID (as an OpenGL constant), respectively. This action also returns an array containing all of the names of the inputs in this program.

Parameters

  • integer x
  • integer y
  • integer width
  • integer height

SetShaderCode(integer shaderID, text source)

This action associates shader code with a shader ID.

Parameters

  • integer shaderID
  • text source

SetShaderInput(integer uniformID, number value1, number value2, number value3)

This action sets the value of a shader "uniform" variable to the given input values. The uniform is identified by a unique ID that is generated when a shader program using that uniform is compiled and linked.

Parameters

  • integer uniformID
  • number value1
  • number value2
  • number value3

SetShaderInput(integer uniformID, number value1, number value2)

This action sets the value of a shader "uniform" variable to the given input values. The uniform is identified by a unique ID that is generated when a shader program using that uniform is compiled and linked.

Parameters

  • integer uniformID
  • number value1
  • number value2

SetShaderInput(integer uniformID, number value1, number value2, number value3, number value4)

This action sets the value of a shader "uniform" variable to the given input values. The uniform is identified by a unique ID that is generated when a shader program using that uniform is compiled and linked.

Parameters

  • integer uniformID
  • number value1
  • number value2
  • number value3
  • number value4

SetShaderInput(integer uniformID, integer value1)

This action sets the value of a shader "uniform" variable to the given input values. The uniform is identified by a unique ID that is generated when a shader program using that uniform is compiled and linked.

Parameters

  • integer uniformID
  • integer value1

SetShaderInput(integer uniformID, integer value1, integer value2, integer value3, integer value4)

This action sets the value of a shader "uniform" variable to the given input values. The uniform is identified by a unique ID that is generated when a shader program using that uniform is compiled and linked.

Parameters

  • integer uniformID
  • integer value1
  • integer value2
  • integer value3
  • integer value4

SetShaderInput(integer uniformID, integer value1, integer value2, integer value3)

This action sets the value of a shader "uniform" variable to the given input values. The uniform is identified by a unique ID that is generated when a shader program using that uniform is compiled and linked.

Parameters

  • integer uniformID
  • integer value1
  • integer value2
  • integer value3

SetShaderInput(integer uniformID, number value)

This action sets the value of a shader "uniform" variable to the given input values. The uniform is identified by a unique ID that is generated when a shader program using that uniform is compiled and linked.

Parameters

  • integer uniformID
  • number value

SetShaderInput(integer uniformID, integer value1, integer value2)

This action sets the value of a shader "uniform" variable to the given input values. The uniform is identified by a unique ID that is generated when a shader program using that uniform is compiled and linked.

Parameters

  • integer uniformID
  • integer value1
  • integer value2

SetShaderInputArray(integer uniformID, Libraries.Containers.Number32BitArray array, integer startIndex, integer length)

This action sets the values of a shader "uniform" array variable. The uniform is identified by a unique ID that is generated when a shader program using the uniform is compiled and linked.

Parameters

  • integer uniformID: An integer ID that represents a uniform in a linked shader program.
  • Libraries.Containers.Number32BitArray: A typed array containing the values to copy to the uniform.
  • integer startIndex: The first index of the array to begin copying.
  • integer length: How many elements should be copied from the input array to the uniform array.

SetShaderInputMatrix3(integer uniformID, Libraries.Containers.Number32BitArray array, boolean transpose)

This action sets the value of a Matrix3 shader "uniform" variable. The uniform is identified by a unique ID that is generated when a shader program using the uniform is compiled and linked. The array is assumed to provide the matrix in column-major order, unless the transpose flag is set to true, in which case it will be assumed to be row-major instead.

Parameters

  • integer uniformID: An integer ID that represents a uniform in a linked shader program.
  • Libraries.Containers.Number32BitArray: A typed array containing the values to copy to the uniform.
  • boolean transpose: If set to true, the uniform will be set to the transpose of the Matrix.

SetShaderInputMatrix3Array(integer uniformID, integer matrixCount, Libraries.Containers.Number32BitArray array, integer startIndex, boolean transpose)

This action sets the value of an array of Matrix3's in a shader "uniform" variable. The uniform is identified by a unique ID that is generated when a shader program using the uniform is compiled and linked. The array is assumed to provide the matrix in column-major order, unless the transpose flag is set to true, in which case it will be assumed to be row-major instead.

Parameters

  • integer uniformID: An integer ID that represents a uniform in a linked shader program.
  • integer matrixCount: How many matrices should be set in the uniform. Each matrix requires 9 sequential values from the source array.
  • Libraries.Containers.Number32BitArray: A typed array containing the values to copy to the uniform.
  • integer startIndex: The first index of the array to begin copying.
  • boolean transpose: If set to true, the uniform will be set to the transpose of the Matrix.

SetShaderInputMatrix4(integer uniformID, Libraries.Containers.Number32BitArray array, boolean transpose)

This action sets the value of a Matrix4 shader "uniform" variable. The uniform is identified by a unique ID that is generated when a shader program using the uniform is compiled and linked. The array is assumed to provide the matrix in column-major order, unless the transpose flag is set to true, in which case it will be assumed to be row-major instead.

Parameters

  • integer uniformID: An integer ID that represents a uniform in a linked shader program.
  • Libraries.Containers.Number32BitArray: A typed array containing the values to copy to the uniform.
  • boolean transpose: If set to true, the uniform will be set to the transpose of the Matrix.

SetShaderInputMatrix4Array(integer uniformID, integer matrixCount, Libraries.Containers.Number32BitArray array, integer startIndex, boolean transpose)

This action sets the value of an array of Matrix4's in a shader "uniform" variable. The uniform is identified by a unique ID that is generated when a shader program using the uniform is compiled and linked. The array is assumed to provide the matrix in column-major order, unless the transpose flag is set to true, in which case it will be assumed to be row-major instead.

Parameters

  • integer uniformID: An integer ID that represents a uniform in a linked shader program.
  • integer matrixCount: How many matrices should be set in the uniform. Each matrix requires 16 sequential values from the source array.
  • Libraries.Containers.Number32BitArray: A typed array containing the values to copy to the uniform.
  • integer startIndex: The first index of the array to begin copying.
  • boolean transpose: If set to true, the uniform will be set to the transpose of the Matrix.

SetShaderInputVector2Array(integer uniformID, Libraries.Containers.Number32BitArray array, integer startIndex, integer length)

This action sets the values of an array of Vector2's in a shader "uniform" array variable. The uniform is identified by a unique ID that is generated when a shader program using the uniform is compiled and linked.

Parameters

  • integer uniformID: An integer ID that represents a uniform in a linked shader program.
  • Libraries.Containers.Number32BitArray: A typed array containing the values to copy to the uniform.
  • integer startIndex: The first index of the array to begin copying.
  • integer length: How many elements should be copied from the input array to the uniform array.

SetShaderInputVector3Array(integer uniformID, Libraries.Containers.Number32BitArray array, integer startIndex, integer length)

This action sets the values of an array of Vector3's in a shader "uniform" array variable. The uniform is identified by a unique ID that is generated when a shader program using the uniform is compiled and linked.

Parameters

  • integer uniformID: An integer ID that represents a uniform in a linked shader program.
  • Libraries.Containers.Number32BitArray: A typed array containing the values to copy to the uniform.
  • integer startIndex: The first index of the array to begin copying.
  • integer length: How many elements should be copied from the input array to the uniform array.

SetShaderInputVector4Array(integer uniformID, Libraries.Containers.Number32BitArray array, integer startIndex, integer length)

This action sets the values of an array of Vector4's in a shader "uniform" array variable. The uniform is identified by a unique ID that is generated when a shader program using the uniform is compiled and linked.

Parameters

  • integer uniformID: An integer ID that represents a uniform in a linked shader program.
  • Libraries.Containers.Number32BitArray: A typed array containing the values to copy to the uniform.
  • integer startIndex: The first index of the array to begin copying.
  • integer length: How many elements should be copied from the input array to the uniform array.

SetTextureParameter(integer targetTexture, integer parameterType, integer parameterValue)

Sets an option identified by the parameterType code inside the texture identified by the given targetTexture ID using the given parameterValue.

Parameters

  • integer targetTexture
  • integer parameterType
  • integer parameterValue

SetVertexInputID(integer programID, integer inputID, text name)

Parameters

  • integer programID
  • integer inputID
  • text name

SetVertexInputInformation(integer inputID, integer size, integer type, boolean normalize, integer stride, integer offset)

This action informs the rendering system of how to interpret elements of vertex input data for a particular input.

Parameters

  • integer inputID: An ID that describes a vertex input.
  • integer size: How many bytes from the array are needed to set a single instance of the input value in the shader. Must be between 1 and 4.
  • integer type: A constant value representing the type of data, such as GL_INT.
  • boolean normalize: If set to true, fixed-point data values will be normalized when passed down to the system. If set to false, the values will be passed down without modification.
  • integer stride: How many bytes of data separate each instance of data meant to be used for this input. If this value is 0, it's assumed that there is no additional data interleaved between data used for this input.
  • integer offset: The index of the first element of this input's data in the input buffer, or in other words, how many bytes of data appear before the first instance of input data for this input.

SetVertexInputInformation(integer inputID, integer size, integer type, boolean normalize, integer stride, Libraries.Game.Graphics.Number32BitBuffer buffer)

This action informs the rendering system of how to interpret elements of vertex input data for a particular input.

Parameters

  • integer inputID: An ID that describes a vertex input.
  • integer size: How many bytes from the array are needed to set a single instance of the input value in the shader. Must be between 1 and 4.
  • integer type: A constant value representing the type of data, such as GL_INT.
  • boolean normalize: If set to true, fixed-point data values will be normalized when passed down to the system. If set to false, the values will be passed down without modification.
  • integer stride: How many bytes of data separate each instance of data meant to be used for this input. If this value is 0, it's assumed that there is no additional data interleaved between data used for this input.
  • Libraries.Game.Graphics.Number32BitBuffer: A buffer containing vertex input data.

SetViewport(integer x, integer y, integer width, integer height)

Parameters

  • integer x
  • integer y
  • integer width
  • integer height

UseDefaultVertexArray()

UseShaderProgram(integer programID)

This action tells the graphics system to render content using the shader program indicated by the provided ID.

Parameters

  • integer programID