Context3D QML Type

Provides the 3D rendering API and context. More...

Import Statement: import QtCanvas3D 1.1
Since: QtCanvas3D 1.0

Properties

Methods

Detailed Description

An uncreatable QML type that provides a WebGL-like API that can be used to draw 3D graphics to the Canvas3D element. You can get it by calling the Canvas3D.getContext method.

See also Canvas3D.

Property Documentation

canvas : Canvas3D

Holds the read only reference to the Canvas3D for this Context3D.


drawingBufferHeight : int

Holds the current read-only logical pixel height of the drawing buffer. To get the height in physical pixels you need to multiply this with the devicePixelRatio.


drawingBufferWidth : int

Holds the current read-only logical pixel width of the drawing buffer. To get the width in physical pixels you need to multiply this with the devicePixelRatio.


Method Documentation

void activeTexture(glEnums texture)

Sets the given texture unit as active. The number of texture units is implementation dependent, but must be at least 8. Initially Context3D.TEXTURE0 is active. texture must be one of Context3D.TEXTUREi values where i ranges from 0 to (Context3D.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1).


void attachShader(Canvas3DProgram program3D, Canvas3DShader shader3D)

Attaches the given shader3D object to the given program3D object. Calling this method repeatedly on the same object has no side effects.


void bindAttribLocation(Canvas3DProgram program3D, int index, string name)

Binds the attribute index with the attribute variable name in the given program3D.


void bindBuffer(glEnums target, Canvas3DBuffer buffer3D)

Binds the given buffer3D to the given target. Target must be either Context3D.ARRAY_BUFFER or Context3D.ELEMENT_ARRAY_BUFFER. If the buffer3D given is null, the current buffer bound to the target is unbound.


void bindFramebuffer(glEnums target, Canvas3DFrameBuffer buffer)

Binds the given buffer object to the given target. target must be Context3D.FRAMEBUFFER.


void bindRenderbuffer(glEnums target, Canvas3DRenderBuffer renderbuffer)

Binds the given renderbuffer3D object to the given target. target must be Context3D.RENDERBUFFER.


void bindTexture(glEnums target, Canvas3DTexture texture3D)

Bind a Canvas3DTexture to a texturing target. target is the target of the active texture unit to which the Canvas3DTexture will be bound. Must be either Context3D.TEXTURE_2D or Context3D.TEXTURE_CUBE_MAP. texture3D is the Canvas3DTexture to be bound.


void blendColor(float red, float green, float blue, float alpha)

Set the blend color. red, green, blue and alpha specify the components of Context3D.BLEND_COLOR.


void blendEquation(glEnums mode)

Sets the equation used for both the RGB blend equation and the alpha blend equation. mode specifies how source and destination colors are to be combined. Must be Context3D.FUNC_ADD, Context3D.FUNC_SUBTRACT or Context3D.FUNC_REVERSE_SUBTRACT.


void blendEquationSeparate(glEnums modeRGB, glEnums modeAlpha)

Set the RGB blend equation and the alpha blend equation separately. modeRGB specifies how the RGB components of the source and destination colors are to be combined. Must be Context3D.FUNC_ADD, Context3D.FUNC_SUBTRACT or Context3D.FUNC_REVERSE_SUBTRACT. modeAlpha specifies how the alpha component of the source and destination colors are to be combined. Must be Context3D.FUNC_ADD, Context3D.FUNC_SUBTRACT, or Context3D.FUNC_REVERSE_SUBTRACT.


void blendFunc(glEnums sfactor, glEnums dfactor)

Sets the pixel arithmetic. sfactor specifies how the RGBA source blending factors are computed. Must be Context3D.ZERO, Context3D.ONE, Context3D.SRC_COLOR, Context3D.ONE_MINUS_SRC_COLOR, Context3D.DST_COLOR, Context3D.ONE_MINUS_DST_COLOR, Context3D.SRC_ALPHA, Context3D.ONE_MINUS_SRC_ALPHA, Context3D.DST_ALPHA, Context3D.ONE_MINUS_DST_ALPHA, Context3D.CONSTANT_COLOR, Context3D.ONE_MINUS_CONSTANT_COLOR, Context3D.CONSTANT_ALPHA, Context3D.ONE_MINUS_CONSTANT_ALPHA or Context3D.SRC_ALPHA_SATURATE. Initial value is Context3D.ONE. dfactor Specifies how the RGBA destination blending factors are computed. Must be Context3D.ZERO, Context3D.ONE, Context3D.SRC_COLOR, Context3D.ONE_MINUS_SRC_COLOR, Context3D.DST_COLOR, Context3D.ONE_MINUS_DST_COLOR, Context3D.SRC_ALPHA, Context3D.ONE_MINUS_SRC_ALPHA, Context3D.DST_ALPHA, Context3D.ONE_MINUS_DST_ALPHA, Context3D.CONSTANT_COLOR, Context3D.ONE_MINUS_CONSTANT_COLOR, Context3D.CONSTANT_ALPHA or Context3D.ONE_MINUS_CONSTANT_ALPHA. Initial value is Context3D.ZERO.


void blendFuncSeparate(glEnums srcRGB, glEnums dstRGB, glEnums srcAlpha, glEnums dstAlpha)

Sets the pixel arithmetic for RGB and alpha components separately. srcRGB specifies how the RGB source blending factors are computed. Must be Context3D.ZERO, Context3D.ONE, Context3D.SRC_COLOR, Context3D.ONE_MINUS_SRC_COLOR, Context3D.DST_COLOR, Context3D.ONE_MINUS_DST_COLOR, Context3D.SRC_ALPHA, Context3D.ONE_MINUS_SRC_ALPHA, Context3D.DST_ALPHA, Context3D.ONE_MINUS_DST_ALPHA, Context3D.CONSTANT_COLOR, Context3D.ONE_MINUS_CONSTANT_COLOR, Context3D.CONSTANT_ALPHA, Context3D.ONE_MINUS_CONSTANT_ALPHA or Context3D.SRC_ALPHA_SATURATE. Initial value is Context3D.ONE. dstRGB Specifies how the RGB destination blending factors are computed. Must be Context3D.ZERO, Context3D.ONE, Context3D.SRC_COLOR, Context3D.ONE_MINUS_SRC_COLOR, Context3D.DST_COLOR, Context3D.ONE_MINUS_DST_COLOR, Context3D.SRC_ALPHA, Context3D.ONE_MINUS_SRC_ALPHA, Context3D.DST_ALPHA, Context3D.ONE_MINUS_DST_ALPHA, Context3D.CONSTANT_COLOR, Context3D.ONE_MINUS_CONSTANT_COLOR, Context3D.CONSTANT_ALPHA or Context3D.ONE_MINUS_CONSTANT_ALPHA. Initial value is Context3D.ZERO. srcAlpha specifies how the alpha source blending factors are computed. Must be Context3D.ZERO, Context3D.ONE, Context3D.SRC_COLOR, Context3D.ONE_MINUS_SRC_COLOR, Context3D.DST_COLOR, Context3D.ONE_MINUS_DST_COLOR, Context3D.SRC_ALPHA, Context3D.ONE_MINUS_SRC_ALPHA, Context3D.DST_ALPHA, Context3D.ONE_MINUS_DST_ALPHA, Context3D.CONSTANT_COLOR, Context3D.ONE_MINUS_CONSTANT_COLOR, Context3D.CONSTANT_ALPHA, Context3D.ONE_MINUS_CONSTANT_ALPHA or Context3D.SRC_ALPHA_SATURATE. Initial value is Context3D.ONE. dstAlpha Specifies how the alpha destination blending factors are computed. Must be Context3D.ZERO, Context3D.ONE, Context3D.SRC_COLOR, Context3D.ONE_MINUS_SRC_COLOR, Context3D.DST_COLOR, Context3D.ONE_MINUS_DST_COLOR, Context3D.SRC_ALPHA, Context3D.ONE_MINUS_SRC_ALPHA, Context3D.DST_ALPHA, Context3D.ONE_MINUS_DST_ALPHA, Context3D.CONSTANT_COLOR, Context3D.ONE_MINUS_CONSTANT_COLOR, Context3D.CONSTANT_ALPHA or Context3D.ONE_MINUS_CONSTANT_ALPHA. Initial value is Context3D.ZERO.


void bufferData(glEnums target, value data, glEnums usage)

Writes the data held in ArrayBufferView or ArrayBuffer to the target buffer. Target buffer must be either Context3D.ARRAY_BUFFER or Context3D.ELEMENT_ARRAY_BUFFER. usage sets the usage pattern of the data, and must be one of Context3D.STREAM_DRAW, Context3D.STATIC_DRAW, or Context3D.DYNAMIC_DRAW.


void bufferData(glEnums target, long size, glEnums usage)

Sets the size of the target buffer to size. Target buffer must be either Context3D.ARRAY_BUFFER or Context3D.ELEMENT_ARRAY_BUFFER. usage sets the usage pattern of the data, and must be one of Context3D.STREAM_DRAW, Context3D.STATIC_DRAW, or Context3D.DYNAMIC_DRAW.


void bufferSubData(glEnums target, int offset, value data)

Writes the data held in ArrayBufferView or ArrayBuffer starting from offset to the target buffer. Target buffer must be either Context3D.ARRAY_BUFFER or Context3D.ELEMENT_ARRAY_BUFFER.


Context3D::glEnums checkFramebufferStatus(glEnums target)

Returns the completeness status of the framebuffer object. target must be Context3D.FRAMEBUFFER. This command is handled synchronously.


void clear(glEnums flags)

Clears the given flags.


void clearColor(float red, float green, float blue, float alpha)

Sets the clear values for the color buffers with red, green, blue and alpha. Values must be between [0, 1]. All default to 0.


void clearDepth(float depth)

Sets the clear value for the depth buffer to depth. Must be between [0, 1]. Defaults to 1.


void clearStencil(int stencil)

Sets the clear value for the stencil buffer to stencil. Defaults to 0.


void colorMask(bool maskRed, bool maskGreen, bool maskBlue, bool maskAlpha)

Enables or disables the writing of colors to the frame buffer based on maskRed, maskGreen, maskBlue and maskAlpha. All default to true.


void compileShader(Canvas3DShader shader)

Compiles the given shader object.


void compressedTexImage2D(glEnums target, int level, glEnums internalformat, int width, int height, int border, TypedArray pixels)

Specify a 2D compressed texture image. target specifies the target texture of the active texture unit. Must be one of: Context3D.TEXTURE_2D, Context3D.TEXTURE_CUBE_MAP_POSITIVE_X, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_X, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Y, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Y, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Z, or Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Z. level specifies the level of detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. internalformat specifies the internal format of the compressed texture. width specifies the width of the texture image. All implementations will support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide. height specifies the height of the texture image. All implementations will support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high. border must be 0. pixels specifies the TypedArray containing the compressed image data.


void compressedTexSubImage2D(glEnums target, int level, int xoffset, int yoffset, int width, int height, glEnums format, TypedArray pixels)

Specify a 2D compressed texture image. target specifies the target texture of the active texture unit. Must be one of: Context3D.TEXTURE_2D, Context3D.TEXTURE_CUBE_MAP_POSITIVE_X, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_X, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Y, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Y, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Z, or Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Z. level specifies the level of detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. xoffset Specifies a texel offset in the x direction within the texture array. yoffset Specifies a texel offset in the y direction within the texture array. width Width of the texture subimage. height Height of the texture subimage. pixels specifies the TypedArray containing the compressed image data. format Format of the texel data given in pixels, must match the value of internalFormat parameter given when the texture was created. pixels TypedArray containing the compressed image data. If pixels is null.


void copyTexImage2D(glEnums target, int level, glEnums internalformat, int x, int y, int width, int height, int border)

Copies pixels into currently bound 2D texture. target specifies the target texture of the active texture unit. Must be Context3D.TEXTURE_2D, Context3D.TEXTURE_CUBE_MAP_POSITIVE_X, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_X, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Y, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Y, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Z, or Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Z. level specifies the level of detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. internalformat specifies the internal format of the texture. Must be Context3D.ALPHA, Context3D.LUMINANCE, Context3D.LUMINANCE_ALPHA, Context3D.RGB or Context3D.RGBA. x specifies the window coordinate of the left edge of the rectangular region of pixels to be copied. y specifies the window coordinate of the lower edge of the rectangular region of pixels to be copied. width specifies the width of the texture image. All implementations will support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide. height specifies the height of the texture image. All implementations will support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high. border must be 0.


void copyTexSubImage2D(glEnums target, int level, int xoffset, int yoffset, int x, int y, int width, int height)

Copies to into a currently bound 2D texture subimage. target specifies the target texture of the active texture unit. Must be Context3D.TEXTURE_2D, Context3D.TEXTURE_CUBE_MAP_POSITIVE_X, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_X, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Y, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Y, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Z, or Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Z. level specifies the level of detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. xoffset specifies the texel offset in the x direction within the texture array. yoffset specifies the texel offset in the y direction within the texture array. x specifies the window coordinate of the left edge of the rectangular region of pixels to be copied. y specifies the window coordinate of the lower edge of the rectangular region of pixels to be copied. width specifies the width of the texture subimage. height specifies the height of the texture subimage.


Canvas3DBuffer createBuffer()

Creates a Canvas3DBuffer object and initializes it with a buffer object name as if glGenBuffers() was called.


Canvas3DFrameBuffer createFramebuffer()

Returns a created Canvas3DFrameBuffer object that is initialized with a framebuffer object name as if by calling glGenFramebuffers().


Canvas3DProgram createProgram()

Returns a created Canvas3DProgram object that is initialized with a program object name as if by calling glCreateProgram().


Canvas3DRenderBuffer createRenderbuffer()

Returns a created Canvas3DRenderBuffer object that is initialized with a renderbuffer object name as if by calling glGenRenderbuffers().


Canvas3DShader createShader(glEnums type)

Creates a shader of type. Must be either Context3D.VERTEX_SHADER or Context3D.FRAGMENT_SHADER.


Canvas3DTexture createTexture()

Create a Canvas3DTexture object and initialize a name for it as by calling glGenTextures().


void cullFace(glEnums mode)

Sets the culling to mode. Must be one of Context3D.FRONT, Context3D.BACK, or Context3D.FRONT_AND_BACK. Defaults to Context3D.BACK.


void deleteBuffer(Canvas3DBuffer buffer3D)

Deletes the buffer3D. Has no effect if the Canvas3DBuffer object has been deleted already.


void deleteFramebuffer(Canvas3DFrameBuffer buffer)

Deletes the given framebuffer as if by calling glDeleteFramebuffers(). Calling this method repeatedly on the same object has no side effects. buffer is the Canvas3DFrameBuffer to be deleted.


void deleteProgram(Canvas3DProgram program3D)

Deletes the given program as if by calling glDeleteProgram(). Calling this method repeatedly on the same object has no side effects. program3D is the Canvas3DProgram to be deleted.


void deleteRenderbuffer(Canvas3DRenderBuffer renderbuffer3D)

Deletes the given renderbuffer as if by calling glDeleteRenderbuffers(). Calling this method repeatedly on the same object has no side effects. renderbuffer3D is the Canvas3DRenderBuffer to be deleted.


void deleteShader(Canvas3DShader shader)

Deletes the given shader as if by calling glDeleteShader(). Calling this method repeatedly on the same object has no side effects. shader is the Canvas3DShader to be deleted.


void deleteTexture(Canvas3DTexture texture3D)

Deletes the given texture as if by calling glDeleteTextures(). Calling this method repeatedly on the same object has no side effects. texture3D is the Canvas3DTexture to be deleted.


void depthFunc(glEnums func)

Sets the depth function to func. Must be one of Context3D.NEVER, Context3D.LESS, Context3D.EQUAL, Context3D.LEQUAL, Context3D.GREATER, Context3D.NOTEQUAL, Context3D.GEQUAL, or Context3D.ALWAYS. Defaults to Context3D.LESS.


void depthMask(bool flag)

Enables or disables the depth mask based on flag. Defaults to true.


void depthRange(float zNear, float zFar)

Sets the depth range between zNear and zFar. Values are clamped to [0, 1]. zNear must be less or equal to zFar. zNear Range defaults to [0, 1].


void detachShader(Canvas3DProgram program, Canvas3DShader shader)

Detaches given shader object from given program object. program3D specifies the program object from which to detach the shader. shader3D specifies the shader object to detach.


void disable(glEnums cap)

Disable server side GL capabilities. cap specifies a constant indicating a GL capability.


void disableVertexAttribArray(int index)

Disables the vertex attribute array at index.


void drawArrays(glEnums mode, int first, int count)

Renders the geometric primitives held in the currently bound array buffer starting from first up to count using mode for drawing. Mode can be one of:

  • Context3D.POINTS
  • Context3D.LINES
  • Context3D.LINE_LOOP
  • Context3D.LINE_STRIP
  • Context3D.TRIANGLES
  • Context3D.TRIANGLE_STRIP
  • Context3D.TRIANGLE_FAN

void drawElements(glEnums mode, int count, glEnums type, long offset)

Renders the number of geometric elements given in count held in the currently bound element array buffer using mode for drawing. Mode can be one of:

  • Context3D.POINTS
  • Context3D.LINES
  • Context3D.LINE_LOOP
  • Context3D.LINE_STRIP
  • Context3D.TRIANGLES
  • Context3D.TRIANGLE_STRIP
  • Context3D.TRIANGLE_FAN

type specifies the element type and can be one of:

  • Context3D.UNSIGNED_BYTE
  • Context3D.UNSIGNED_SHORT

offset specifies the location3D where indices are stored.


void enable(glEnums cap)

Enable server side GL capabilities. cap specifies a constant indicating a GL capability.


void enableVertexAttribArray(int index)

Enables the vertex attribute array at index.


void finish()

Forces all previous 3D rendering commands to complete. This command is handled synchronously.


void flush()

Indicates to graphics driver that previously sent commands must complete within finite time.


void framebufferRenderbuffer(glEnums target, glEnums attachment, glEnums renderbuffertarget, Canvas3DRenderBuffer renderbuffer3D)

Attaches the given renderbuffer3D object to the attachment point of the current framebuffer object. target must be Context3D.FRAMEBUFFER. renderbuffertarget must be Context3D.RENDERBUFFER.


void framebufferTexture2D(glEnums target, glEnums attachment, glEnums textarget, Canvas3DTexture texture3D, int level)

Attaches the given renderbuffer object to the attachment point of the current framebuffer object. target must be Context3D.FRAMEBUFFER. renderbuffertarget must be Context3D.RENDERBUFFER.


void frontFace(glEnums mode)

Sets the front face drawing to mode. Must be either Context3D.CW or Context3D.CCW. Defaults to Context3D.CCW.


void generateMipmap(glEnums target)

Generates a complete set of mipmaps for a texture object of the currently active texture unit. target defines the texture target to which the texture object is bound whose mipmaps will be generated. Must be either Context3D.TEXTURE_2D or Context3D.TEXTURE_CUBE_MAP.


Canvas3DActiveInfo getActiveAttrib(Canvas3DProgram program3D, uint index)

Returns information about the given active attribute variable defined by index for the given program3D. This command is handled synchronously.

See also Canvas3DActiveInfo.


Canvas3DActiveInfo getActiveUniform(Canvas3DProgram program3D, uint index)

Returns information about the given active uniform variable defined by index for the given program3D. This command is handled synchronously.

See also Canvas3DActiveInfo.


list<Canvas3DShader> getAttachedShaders(Canvas3DProgram program3D)

Returns the list of shaders currently attached to the given program3D.


int getAttribLocation(Canvas3DProgram program3D, string name)

Returns location3D of the given attribute variable name in the given program3D. This command is handled synchronously.


value getBufferParameter(glEnums target, glEnums pname)

Returns the value for the passed pname of the target. Target must be either Context3D.ARRAY_BUFFER or Context3D.ELEMENT_ARRAY_BUFFER. pname must be either Context3D.BUFFER_SIZE or Context3D.BUFFER_USAGE. This command is handled synchronously.


Canvas3DContextAttributes getContextAttributes()

Returns a copy of the actual context parameters that are used in the current context.


glEnums getError()

Returns the error value, if any. This command is handled synchronously.


variant getExtension(string name)

Returns object if given name matches a supported extension. Otherwise returns null. The returned object may contain constants and/or functions provided by the extension, but at minimum a unique object is returned. Case-insensitive name of the extension to be returned.


int getFramebufferAttachmentParameter(glEnums target, glEnums attachment, glEnums pname)

Returns information specified by pname about given attachment of a framebuffer object bound to the given target. This command is handled synchronously.


variant getParameter(glEnums pname)

Returns the value for the given pname. This command is handled synchronously.


string getProgramInfoLog(Canvas3DProgram program3D)

Returns the info log string of the given program3D. This command is handled synchronously.


variant getProgramParameter(Canvas3DProgram program3D, glEnums paramName)

Return the value for the passed paramName given the passed program3D. The type returned is the natural type for the requested paramName. paramName must be Context3D.DELETE_STATUS, Context3D.LINK_STATUS, Context3D.VALIDATE_STATUS, Context3D.ATTACHED_SHADERS, Context3D.ACTIVE_ATTRIBUTES or Context3D.ACTIVE_UNIFORMS. This command is handled synchronously.


int getRenderbufferParameter(glEnums target, glEnums pname)

Returns information specified by pname of a renderbuffer object bound to the given target. This command is handled synchronously.


string getShaderInfoLog(Canvas3DShader shader)

Returns the info log string of the given shader. This command is handled synchronously.


int getShaderParameter(Canvas3DShader shader, glEnums pname)

Returns the value of the passed pname for the given shader. pname must be one of Context3D.SHADER_TYPE, Context3D.DELETE_STATUS and Context3D.COMPILE_STATUS. This command is handled synchronously.


Canvas3DShaderPrecisionFormat getShaderPrecisionFormat(glEnums shadertype, glEnums precisiontype)

Return a new Canvas3DShaderPrecisionFormat describing the range and precision for the specified shader numeric format. shadertype Type of the shader, either Context3D.FRAGMENT_SHADER or Context3D.VERTEX_SHADER. precisiontype Can be Context3D.LOW_FLOAT, Context3D.MEDIUM_FLOAT, Context3D.HIGH_FLOAT, Context3D.LOW_INT, Context3D.MEDIUM_INT or Context3D.HIGH_INT. This command is handled synchronously.

See also Canvas3DShaderPrecisionFormat.


string getShaderSource(Canvas3DShader shader)

Returns the source code string from the shader object.


list<variant> getSupportedExtensions()

Returns an array of the extension strings supported by this implementation


variant getTexParameter(glEnums target, glEnums pname)

Returns parameter specified by the pname of a texture object bound to the given target. pname must be one of:

  • Context3D.TEXTURE_MAG_FILTER
  • Context3D.TEXTURE_MIN_FILTER
  • Context3D.TEXTURE_WRAP_S
  • Context3D.TEXTURE_WRAP_T

This command is handled synchronously.


variant getUniform(Canvas3DProgram program, Canvas3DUniformLocation location3D)

Returns the uniform value at the given location3D in the program. The type returned is dependent on the uniform type, as shown in the table:

Uniform TypeReturned Type
booleanboolean
intint
floatfloat
vec2Float32Array (with 2 elements)
vec3Float32Array (with 3 elements)
vec4Float32Array (with 4 elements)
ivec2Int32Array (with 2 elements)
ivec3Int32Array (with 3 elements)
ivec4Int32Array (with 4 elements)
bvec2sequence<boolean> (with 2 elements)
bvec3sequence<boolean> (with 3 elements)
bvec4sequence<boolean> (with 4 elements)
mat2Float32Array (with 4 elements)
mat3Float32Array (with 9 elements)
mat4Float32Array (with 16 elements)
sampler2Dint
samplerCubeint

This command is handled synchronously.


Canvas3DUniformLocation getUniformLocation(Canvas3DProgram program3D, string name)

Returns Canvas3DUniformLocation object that represents the location3D of a specific uniform variable with the given name within the given program3D object. Returns null if name doesn't correspond to a uniform variable.


variant getVertexAttrib(int index, glEnums pname)

Returns the requested parameter pname of the specified generic vertex attribute pointer index. The type returned is dependent on the requested pname, as shown in the table:

pnameReturned Type
Context3D.VERTEX_ATTRIB_ARRAY_BUFFER_BINDINGCanvas3DBuffer
Context3D.VERTEX_ATTRIB_ARRAY_ENABLEDboolean
Context3D.VERTEX_ATTRIB_ARRAY_SIZEint
Context3D.VERTEX_ATTRIB_ARRAY_STRIDEint
Context3D.VERTEX_ATTRIB_ARRAY_TYPEglEnums
Context3D.VERTEX_ATTRIB_ARRAY_NORMALIZEDboolean
Context3D.CURRENT_VERTEX_ATTRIBFloat32Array (with 4 elements)

This command is handled synchronously.


int getVertexAttribOffset(int index, glEnums pname)

Returns the offset of the specified generic vertex attribute pointer index. pname must be Context3D.VERTEX_ATTRIB_ARRAY_POINTER

  • Context3D.TEXTURE_MAG_FILTER
  • Context3D.TEXTURE_MIN_FILTER
  • Context3D.TEXTURE_WRAP_S
  • Context3D.TEXTURE_WRAP_T

This command is handled synchronously.


void hint(glEnums target, glEnums mode)

Set implementation-specific hints. target Context3D.GENERATE_MIPMAP_HINT is accepted. mode Context3D.FASTEST, Context3D.NICEST, and Context3D.DONT_CARE are accepted.


bool isBuffer(Object anyObject)

Returns true if the given anyObect is a valid Canvas3DBuffer object, false otherwise. This command is handled synchronously.


bool isContextLost()

Returns true if the context is currently lost.

See also Canvas3D.contextLost.


bool isEnabled(glEnums cap)

Returns whether a capability is enabled. cap specifies a constant indicating a GL capability. This command is handled synchronously.


void isFramebuffer(Object anyObject)

Returns true if the given object is a valid Canvas3DFrameBuffer object. anyObject is the object that is to be verified as a valid framebuffer. This command is handled synchronously.


bool isProgram(Object anyObject)

Returns true if the given object is a valid Canvas3DProgram object. anyObject is the object that is to be verified as a valid program. This command is handled synchronously.


bool isRenderbuffer(Object anyObject)

Returns true if the given object is a valid Canvas3DRenderBuffer object. anyObject is the object that is to be verified as a valid renderbuffer. This command is handled synchronously.


bool isShader(Object anyObject)

Returns true if the given object is a valid Canvas3DShader object. anyObject is the object that is to be verified as a valid shader. This command is handled synchronously.


bool isTexture(Object anyObject)

Returns true if the given object is a valid Canvas3DTexture object. anyObject is the object that is to be verified as a valid texture. This command is handled synchronously.


void lineWidth(float width)

Specifies the width of rasterized lines. width specifies the width to be used when rasterizing lines. Initial value is 1.0.


void linkProgram(Canvas3DProgram program3D)

Links the given program object. program3D specifies the program to be linked.


void pixelStorei(glEnums pname, int param)

Set the pixel storage modes. pname specifies the name of the parameter to be set. Context3D.PACK_ALIGNMENT affects the packing of pixel data into memory. Context3D.UNPACK_ALIGNMENT affects the unpacking of pixel data from memory. Context3D.UNPACK_FLIP_Y_WEBGL is initially false, but once set, in any subsequent calls to texImage2D or texSubImage2D, the source data is flipped along the vertical axis. Context3D.UNPACK_PREMULTIPLY_ALPHA_WEBGL is initially false, but once set, in any subsequent calls to texImage2D or texSubImage2D, the alpha channel of the source data, is multiplied into the color channels during the data transfer. Initial value is false and any non-zero value is interpreted as true.

param specifies the value that pname is set to.


void polygonOffset(float factor, float units)

Sets scale and units used to calculate depth values. factor specifies the scale factor that is used to create a variable depth offset for each polygon. Initial value is 0.0. units gets multiplied by an implementation-specific value to create a constant depth offset. Initial value is 0.0.


void readPixels(int x, int y, long width, long height, glEnums format, glEnums type, ArrayBufferView pixels)

Returns the pixel data in the rectangle specified by x, y, width and height of the frame buffer in pixels using format (must be Context3D.RGBA) and type (must be Context3D.UNSIGNED_BYTE). This command is handled synchronously.


void renderbufferStorage(glEnums target, glEnums internalformat, int width, int height)

Create and initialize a data store for the renderbuffer object. target must be Context3D.RENDERBUFFER. internalformat specifies the color-renderable, depth-renderable or stencil-renderable format of the renderbuffer. Must be one of Context3D.RGBA4, Context3D.RGB565, Context3D.RGB5_A1, Context3D.DEPTH_COMPONENT16, Context3D.STENCIL_INDEX8, or Context3D.DEPTH_STENCIL. width specifies the renderbuffer width in pixels. height specifies the renderbuffer height in pixels.


void sampleCoverage(float value, bool invert)

Sets the multisample coverage parameters. value specifies the floating-point sample coverage value. The value is clamped to the range [0, 1] with initial value of 1.0. invert specifies if coverage masks should be inverted.


void scissor(int x, int y, int width, int height)

Defines a rectangle that constrains the drawing. x is theleft edge of the rectangle. y is the bottom edge of the rectangle. width is the width of the rectangle. height is the height of the rectangle.


void shaderSource(Canvas3DShader shader, string shaderSource)

Replaces the shader source code in the given shader object. shader specifies the shader object whose source code is to be replaced. shaderSource specifies the source code to be loaded in to the shader.


void stencilFunc(glEnums func, int ref, uint mask)

Sets front and back function func and reference value ref for stencil testing. Also sets the mask value that is ANDed with both reference and stored stencil value when the test is done. func is initially set to Context3D.ALWAYS and can be one of:

  • Context3D.NEVER
  • Context3D.LESS
  • Context3D.LEQUAL
  • Context3D.GREATER
  • Context3D.GEQUAL
  • Context3D.EQUAL
  • Context3D.NOTEQUAL
  • Context3D.ALWAYS

void stencilFuncSeparate(glEnums face, glEnums func, int ref, uint mask)

Sets front and/or back (defined by face) function func and reference value ref for stencil testing. Also sets the mask value that is ANDed with both reference and stored stencil value when the test is done. face can be one of:

  • Context3D.FRONT
  • Context3D.BACK
  • Context3D.FRONT_AND_BACK

func is initially set to Context3D.ALWAYS and can be one of:

  • Context3D.NEVER
  • Context3D.LESS
  • Context3D.LEQUAL
  • Context3D.GREATER
  • Context3D.GEQUAL
  • Context3D.EQUAL
  • Context3D.NOTEQUAL
  • Context3D.ALWAYS

void stencilMask(uint mask)

Controls the front and back writing of individual bits in the stencil planes. mask defines the bit mask to enable and disable writing of individual bits in the stencil planes.


void stencilMaskSeparate(glEnums face, uint mask)

Controls the front and/or back writing (defined by face) of individual bits in the stencil planes. mask defines the bit mask to enable and disable writing of individual bits in the stencil planes. face can be one of:

  • Context3D.FRONT
  • Context3D.BACK
  • Context3D.FRONT_AND_BACK

void stencilOp(glEnums sfail, glEnums zfail, glEnums zpass)

Sets the front and back stencil test actions for failing the test zfail and passing the test zpass. sfail, zfail and zpass are initially set to Context3D.KEEP and can be one of:

  • Context3D.KEEP
  • Context3D.ZERO
  • Context3D.GL_REPLACE
  • Context3D.GL_INCR
  • Context3D.GL_INCR_WRAP
  • Context3D.GL_DECR
  • Context3D.GL_DECR_WRAP
  • Context3D.GL_INVERT

void stencilOpSeparate(glEnums face, glEnums fail, glEnums zfail, glEnums zpass)

Sets the front and/or back (defined by face) stencil test actions for failing the test zfail and passing the test zpass. face can be one of:

  • Context3D.FRONT
  • Context3D.BACK
  • Context3D.FRONT_AND_BACK

sfail, zfail and zpass are initially set to Context3D.KEEP and can be one of:

  • Context3D.KEEP
  • Context3D.ZERO
  • Context3D.GL_REPLACE
  • Context3D.GL_INCR
  • Context3D.GL_INCR_WRAP
  • Context3D.GL_DECR
  • Context3D.GL_DECR_WRAP
  • Context3D.GL_INVERT

void texImage2D(glEnums target, int level, glEnums internalformat, glEnums format, glEnums type, TextureImage texImage)

Uploads the given TextureImage element to the currently bound Canvas3DTexture. target Target texture of the active texture unit. Must be Context3D.TEXTURE_2D, Context3D.TEXTURE_CUBE_MAP_POSITIVE_X, Context3D.TEXTURE_CUBE_MAP__NEGATIVE_X, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Y, Context3D.TEXTURE_CUBE_MAP__NEGATIVE_Y, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Z, or Context3D.TEXTURE_CUBE_MAP__NEGATIVE_Z. level Level of detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. internalformat Internal format of the texture, conceptually the given image is first converted to this format, then uploaded. Must be Context3D.ALPHA, Context3D.LUMINANCE, Context3D.LUMINANCE_ALPHA, Context3D.RGB or Context3D.RGBA. format Format of the texture, must match the value of internalFormat. type Type of the data, conceptually the given image is first converted to this type, then uploaded. Must be Context3D.UNSIGNED_BYTE, Context3D.UNSIGNED_SHORT_5_6_5, Context3D.UNSIGNED_SHORT_4_4_4_4 or Context3D.UNSIGNED_SHORT_5_5_5_1. texImage A complete TextureImage loaded using the TextureImageFactory.


void texImage2D(glEnums target, int level, glEnums internalformat, int width, int height, int border, glEnums format, glEnums type, TypedArray pixels)

Specify a 2D texture image. target specifies the target texture of the active texture unit. Must be one of: Context3D.TEXTURE_2D, Context3D.TEXTURE_CUBE_MAP_POSITIVE_X, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_X, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Y, Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Y, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Z, or Context3D.TEXTURE_CUBE_MAP_NEGATIVE_Z. level specifies the level of detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. internalformat specifies the internal format of the texture. Must be Context3D.ALPHA, Context3D.LUMINANCE, Context3D.LUMINANCE_ALPHA, Context3D.RGB or Context3D.RGBA. width specifies the width of the texture image. All implementations will support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide. height specifies the height of the texture image. All implementations will support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high. border must be 0. format specifies the format of the texel data given in pixels, must match the value of internalFormat. type specifies the data type of the data given in pixels, must match the TypedArray type of pixels. Must be Context3D.UNSIGNED_BYTE, Context3D.UNSIGNED_SHORT_5_6_5, Context3D.UNSIGNED_SHORT_4_4_4_4 or Context3D.UNSIGNED_SHORT_5_5_5_1. pixels specifies the TypedArray containing the image data. If pixels is null, a buffer of sufficient size initialized to 0 is passed.


void texParameterf(glEnums target, glEnums pname, float param)

Sets texture parameters. target specifies the target texture of the active texture unit. Must be Context3D.TEXTURE_2D or Context3D.TEXTURE_CUBE_MAP. pname specifies the symbolic name of a texture parameter. pname can be Context3D.TEXTURE_MIN_FILTER, Context3D.TEXTURE_MAG_FILTER, Context3D.TEXTURE_WRAP_S or Context3D.TEXTURE_WRAP_T. param specifies the new float value to be set to pname


void texParameteri(glEnums target, glEnums pname, float param)

Sets texture parameters. target specifies the target texture of the active texture unit. Must be Context3D.TEXTURE_2D or Context3D.TEXTURE_CUBE_MAP. pname specifies the symbolic name of a texture parameter. pname can be Context3D.TEXTURE_MIN_FILTER, Context3D.TEXTURE_MAG_FILTER, Context3D.TEXTURE_WRAP_S or Context3D.TEXTURE_WRAP_T. param specifies the new int value to be set to pname


void texSubImage2D(glEnums target, int level, int xoffset, int yoffset, glEnums format, glEnums type, TextureImage texImage)

Uploads the given TextureImage element to the currently bound Canvas3DTexture. target specifies the target texture of the active texture unit. Must be Context3D.TEXTURE_2D, Context3D.TEXTURE_CUBE_MAP_POSITIVE_X, Context3D.TEXTURE_CUBE_MAP__NEGATIVE_X, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Y, Context3D.TEXTURE_CUBE_MAP__NEGATIVE_Y, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Z, or Context3D.TEXTURE_CUBE_MAP__NEGATIVE_Z. level Level of detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. internalformat Internal format of the texture, conceptually the given image is first converted to this format, then uploaded. Must be Context3D.ALPHA, Context3D.LUMINANCE, Context3D.LUMINANCE_ALPHA, Context3D.RGB or Context3D.RGBA. format Format of the texture, must match the value of internalFormat. type Type of the data, conceptually the given image is first converted to this type, then uploaded. Must be Context3D.UNSIGNED_BYTE, Context3D.UNSIGNED_SHORT_5_6_5, Context3D.UNSIGNED_SHORT_4_4_4_4 or Context3D.UNSIGNED_SHORT_5_5_5_1. texImage A complete TextureImage loaded using the TextureImageFactory.


void texSubImage2D(glEnums target, int level, int xoffset, int yoffset, int width, int height, glEnums format, glEnums type, TypedArray pixels)

Specify a 2D texture subimage. target Target texture of the active texture unit. Must be Context3D.TEXTURE_2D, Context3D.TEXTURE_CUBE_MAP_POSITIVE_X, Context3D.TEXTURE_CUBE_MAP__NEGATIVE_X, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Y, Context3D.TEXTURE_CUBE_MAP__NEGATIVE_Y, Context3D.TEXTURE_CUBE_MAP_POSITIVE_Z, or Context3D.TEXTURE_CUBE_MAP__NEGATIVE_Z. level Level of detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. xoffset Specifies a texel offset in the x direction within the texture array. yoffset Specifies a texel offset in the y direction within the texture array. width Width of the texture subimage. height Height of the texture subimage. format Format of the texel data given in pixels, must match the value of internalFormat parameter given when the texture was created. type Data type of the data given in pixels, must match the TypedArray type of pixels. Must be Context3D.UNSIGNED_BYTE, Context3D.UNSIGNED_SHORT_5_6_5, Context3D.UNSIGNED_SHORT_4_4_4_4 or Context3D.UNSIGNED_SHORT_5_5_5_1. pixels TypedArray containing the image data.


void uniform1f(Canvas3DUniformLocation location3D, float x)

Sets the single float value given in x to the given uniform location3D.


void uniform1fvt(Canvas3DUniformLocation location3D, Object array)

Sets the float array given in array to the given uniform location3D. array must be a JavaScript Array object or a Float32Array object.


void uniform1i(Canvas3DUniformLocation location3D, int x)

Sets the single integer value given in x to the given uniform location3D.


void uniform1iv(Canvas3DUniformLocation location3D, Int32Array array)

Sets the integer array given in array to the given uniform location3D.


void uniform2f(Canvas3DUniformLocation location3D, float x, float y)

Sets the two float values given in x and y to the given uniform location3D.


void uniform2fv(Canvas3DUniformLocation location3D, Float32Array array)

Sets the float array given in array to the given uniform location3D.


void uniform2i(Canvas3DUniformLocation location3D, int x, int y)

Sets the two integer values given in x and y to the given uniform location3D.


void uniform2iv(Canvas3DUniformLocation location3D, Int32Array array)

Sets the integer array given in array to the given uniform location3D.


void uniform3f(Canvas3DUniformLocation location3D, float x, float y, float z)

Sets the three float values given in x , y and z to the given uniform location3D.


void uniform3fv(Canvas3DUniformLocation location3D, Float32Array array)

Sets the float array given in array to the given uniform location3D.


void uniform3i(Canvas3DUniformLocation location3D, int x, int y, int z)

Sets the three integer values given in x , y and z to the given uniform location3D.


void uniform3iv(Canvas3DUniformLocation location3D, Int32Array array)

Sets the integer array given in array to the given uniform location3D.


void uniform4f(Canvas3DUniformLocation location3D, float x, float y, float z, float w)

Sets the four float values given in x , y , z and w to the given uniform location3D.


void uniform4fv(Canvas3DUniformLocation location3D, Float32Array array)

Sets the float array given in array to the given uniform location3D.


void uniform4i(Canvas3DUniformLocation location3D, int x, int y, int z, int w)

Sets the four integer values given in x , y , z and w to the given uniform location3D.


void uniform4iv(Canvas3DUniformLocation location3D, Int32Array array)

Sets the integer array given in array to the given uniform location3D.


void uniformMatrix2fv(Canvas3DUniformLocation location3D, bool transpose, Value array)

Converts the float array given in array to a 2x2 matrix and sets it to the given uniform at uniformLocation. Applies transpose if set to true.


void uniformMatrix3fv(Canvas3DUniformLocation location3D, bool transpose, Value array)

Converts the float array given in array to a 3x3 matrix and sets it to the given uniform at uniformLocation. Applies transpose if set to true.


void uniformMatrix4fv(Canvas3DUniformLocation location3D, bool transpose, Value array)

Converts the float array given in array to a 4x4 matrix and sets it to the given uniform at uniformLocation. Applies transpose if set to true.


void useProgram(Canvas3DProgram program)

Installs the given program3D as a part of the current rendering state.


void validateProgram(Canvas3DProgram program3D)

Validates the given program3D. The validation status is stored into the state of the shader program container in program3D and can be queried using Context3D.VALIDATE_STATUS as paramName for Context3D.getProgramParameter() method. Additional information may be stored into the program's information log.

See also getProgramInfoLog.


void vertexAttrib1f(int indx, float x)

Sets the single float value given in x to the generic vertex attribute index specified by indx.


void vertexAttrib1fv(int indx, Float32Array array)

Sets the float array given in array to the generic vertex attribute index specified by indx.


void vertexAttrib2f(int indx, float x, float y)

Sets the two float values given in x and y to the generic vertex attribute index specified by indx.


void vertexAttrib2fv(int indx, Float32Array array)

Sets the float array given in array to the generic vertex attribute index specified by indx.


void vertexAttrib3f(int indx, float x, float y, float z)

Sets the three float values given in x , y and z to the generic vertex attribute index specified by indx.


void vertexAttrib3fv(int indx, Float32Array array)

Sets the float array given in array to the generic vertex attribute index specified by indx.


void vertexAttrib4f(int indx, float x, float y, float z, float w)

Sets the four float values given in x , y , z and w to the generic vertex attribute index specified by indx.


void vertexAttrib4fv(int indx, Float32Array array)

Sets the float array given in array to the generic vertex attribute index specified by indx.


void vertexAttribPointer(int indx, int size, glEnums type, bool normalized, int stride, long offset)

Sets the currently bound array buffer to the vertex attribute at the index passed at indx. size is the number of components per attribute. stride specifies the byte offset between consecutive vertex attributes. offset specifies the byte offset to the first vertex attribute in the array. If int values should be normalized, set normalized to true.

type specifies the element type and can be one of:

  • Context3D.BYTE
  • Context3D.UNSIGNED_BYTE
  • Context3D.SHORT
  • Context3D.UNSIGNED_SHORT
  • Context3D.FLOAT

viewport(int x, int y, int width, int height)

Defines the affine transformation from normalized x and y device coordinates to window coordinates within the drawing buffer. x defines the left edge of the viewport. y defines the bottom edge of the viewport. width defines the width of the viewport. height defines the height of the viewport.


© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.