Libraries.Game.Graphics.WebGraphics 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
- Libraries.Language.Object: The object to compare to.
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
- Libraries.Language.Object: The to be compared.
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
- integer programID
- integer index
- Libraries.Language.Types.Integer
- Libraries.Language.Types.Integer
- Libraries.Language.Types.Integer
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
- integer programID
- Libraries.Containers.HashTable
- Libraries.Containers.HashTable
- Libraries.Containers.HashTable
Return
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
- integer programID
- integer index
- Libraries.Language.Types.Integer
- Libraries.Language.Types.Integer
- Libraries.Language.Types.Integer
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
- integer programID
- Libraries.Containers.HashTable
- Libraries.Containers.HashTable
- Libraries.Containers.HashTable
Return
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