Gjsify LogoGjsify Logo

Index

Enumerations

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

Angle: number
Bool: number
Handle: object

Variables

AFIRST_BIT: number
A_BIT: number
BGR_BIT: number
DEPTH_BIT: number
FIXED_0_5: number

The number 0.5 expressed as a #CoglFixed number.

FIXED_1: number

The number 1 expressed as a #CoglFixed number.

FIXED_2_PI: number

Two times pi, expressed as a #CoglFixed number.

FIXED_BITS: number

Evaluates to the number of bits used by the #CoglFixed type.

FIXED_EPSILON: number

A very small number expressed as a #CoglFixed number.

FIXED_MAX: number

The biggest number representable using #CoglFixed

FIXED_MIN: number

The smallest number representable using #CoglFixed

FIXED_PI: number

The number pi, expressed as a #CoglFixed number.

FIXED_PI_2: number

Half pi, expressed as a #CoglFixed number.

FIXED_PI_4: number

pi / 4, expressed as #CoglFixed number.

FIXED_Q: number

Evaluates to the number of bits used for the non-integer part of the #CoglFixed type.

PREMULT_BIT: number
RADIANS_TO_DEGREES: number

Evaluates to 180 / pi in fixed point notation.

SQRTI_ARG_10_PERCENT: number

Maximum argument that can be passed to cogl_sqrti() for which the resulting error is < 10%

SQRTI_ARG_5_PERCENT: number

Maximum argument that can be passed to cogl_sqrti() for which the resulting error is < 5%

SQRTI_ARG_MAX: number

Maximum argument that can be passed to cogl_sqrti() function.

STENCIL_BIT: number
TEXTURE_MAX_WASTE: number

Functions

  • beginGl(): void
  • We do not advise nor reliably support the interleaving of raw GL drawing and Cogl drawing functions, but if you insist, cogl_begin_gl() and cogl_end_gl() provide a simple mechanism that may at least give you a fighting chance of succeeding.

    Note: this doesn't help you modify the behaviour of Cogl drawing functions through the modification of GL state; that will never be reliably supported, but if you are trying to do something like:

    |[ {

    • setup some OpenGL state.
    • draw using OpenGL (e.g. glDrawArrays() )
    • reset modified OpenGL state.
    • continue using Cogl to draw }


    You should surround blocks of drawing using raw GL with cogl_begin_gl()
    and cogl_end_gl():

    |[
    {
    cogl_begin_gl ();
    - setup some OpenGL state.
    - draw using OpenGL (e.g. glDrawArrays() )
    - reset modified OpenGL state.
    cogl_end_gl ();
    - continue using Cogl to draw
    }

    Don't ever try and do:

    |[ {

    • setup some OpenGL state.
    • use Cogl to draw
    • reset modified OpenGL state. }


    When the internals of Cogl evolves, this is very liable to break.

    This function will flush all batched primitives, and subsequently flush
    all internal Cogl state to OpenGL as if it were going to draw something
    itself.

    The result is that the OpenGL modelview matrix will be setup; the state
    corresponding to the current source material will be set up and other world
    state such as backface culling, depth and fogging enabledness will be sent
    to OpenGL.

    <note>No special material state is flushed, so if you want Cogl to setup a
    simplified material state it is your responsibility to set a simple source
    material before calling cogl_begin_gl(). E.g. by calling
    cogl_set_source_color4ub().</note>

    <note>It is your responsibility to restore any OpenGL state that you modify
    to how it was after calling cogl_begin_gl() if you don't do this then the
    result of further Cogl calls is undefined.</note>

    <note>You can not nest begin/end blocks.</note>

    Again we would like to stress, we do not advise the use of this API and if
    possible we would prefer to improve Cogl than have developers require raw
    OpenGL.

    Returns void

  • bitmapErrorQuark(): number
  • blendStringErrorQuark(): number
  • checkExtension(name: string, ext: string): Cogl.Bool
  • Check whether name occurs in list of extensions in ext.

    Parameters

    • name: string

      extension to check for

    • ext: string

      list of extensions

    Returns Cogl.Bool

  • clear(color: Cogl.Color, buffers: number): void
  • Clears all the auxiliary buffers identified in the buffers mask, and if that includes the color buffer then the specified color is used.

    Parameters

    • color: Cogl.Color

      Background color to clear to

    • buffers: number

      A mask of #CoglBufferBit's identifying which auxiliary buffers to clear

    Returns void

  • clipEnsure(): void
  • Ensures that the current clipping region has been set in GL. This will automatically be called before any Cogl primitives but it maybe be neccessary to call if you are using raw GL calls with clipping.

    Returns void

  • clipPop(): void
  • Reverts the clipping region to the state before the last call to cogl_clip_push().

    Returns void

  • clipPush(xOffset: number, yOffset: number, width: number, height: number): void
  • Specifies a rectangular clipping area for all subsequent drawing operations. Any drawing commands that extend outside the rectangle will be clipped so that only the portion inside the rectangle will be displayed. The rectangle dimensions are transformed by the current model-view matrix.

    The rectangle is intersected with the current clip region. To undo the effect of this function, call cogl_clip_pop().

    Parameters

    • xOffset: number

      left edge of the clip rectangle

    • yOffset: number

      top edge of the clip rectangle

    • width: number

      width of the clip rectangle

    • height: number

      height of the clip rectangle

    Returns void

  • clipPushRectangle(x0: number, y0: number, x1: number, y1: number): void
  • Specifies a rectangular clipping area for all subsequent drawing operations. Any drawing commands that extend outside the rectangle will be clipped so that only the portion inside the rectangle will be displayed. The rectangle dimensions are transformed by the current model-view matrix.

    The rectangle is intersected with the current clip region. To undo the effect of this function, call cogl_clip_pop().

    Parameters

    • x0: number

      x coordinate for top left corner of the clip rectangle

    • y0: number

      y coordinate for top left corner of the clip rectangle

    • x1: number

      x coordinate for bottom right corner of the clip rectangle

    • y1: number

      y coordinate for bottom right corner of the clip rectangle

    Returns void

  • clipPushWindowRect(xOffset: number, yOffset: number, width: number, height: number): void
  • Specifies a rectangular clipping area for all subsequent drawing operations. Any drawing commands that extend outside the rectangle will be clipped so that only the portion inside the rectangle will be displayed. The rectangle dimensions are not transformed by the current model-view matrix.

    The rectangle is intersected with the current clip region. To undo the effect of this function, call cogl_clip_pop().

    Parameters

    • xOffset: number

      left edge of the clip rectangle in window coordinates

    • yOffset: number

      top edge of the clip rectangle in window coordinates

    • width: number

      width of the clip rectangle

    • height: number

      height of the clip rectangle

    Returns void

  • clipPushWindowRectangle(xOffset: number, yOffset: number, width: number, height: number): void
  • Specifies a rectangular clipping area for all subsequent drawing operations. Any drawing commands that extend outside the rectangle will be clipped so that only the portion inside the rectangle will be displayed. The rectangle dimensions are not transformed by the current model-view matrix.

    The rectangle is intersected with the current clip region. To undo the effect of this function, call cogl_clip_pop().

    Parameters

    • xOffset: number

      left edge of the clip rectangle in window coordinates

    • yOffset: number

      top edge of the clip rectangle in window coordinates

    • width: number

      width of the clip rectangle

    • height: number

      height of the clip rectangle

    Returns void

  • clipStackRestore(): void
  • Restore the state of the clipping stack that was previously saved by cogl_clip_stack_save().

    Returns void

  • clipStackSave(): void
  • Save the entire state of the clipping stack and then clear all clipping. The previous state can be returned to with cogl_clip_stack_restore(). Each call to cogl_clip_push() after this must be matched by a call to cogl_clip_pop() before calling cogl_clip_stack_restore().

    Returns void

  • clutterCheckExtensionCLUTTER(name: string, ext: string): Cogl.Bool
  • colorEqual(v1: object, v2: object): Cogl.Bool
  • Compares two #CoglColors and checks if they are the same.

    This function can be passed to g_hash_table_new() as the key_equal_func parameter, when using #CoglColors as keys in a #GHashTable.

    Parameters

    • v1: object

      a #CoglColor

    • v2: object

      a #CoglColor

    Returns Cogl.Bool

  • colorInitFromHsl(hue: number, saturation: number, luminance: number): Cogl.Color
  • Converts a color expressed in HLS (hue, luminance and saturation) values into a #CoglColor.

    Parameters

    • hue: number

      hue value, in the 0 .. 360 range

    • saturation: number

      saturation value, in the 0 .. 1 range

    • luminance: number

      luminance value, in the 0 .. 1 range

    Returns Cogl.Color

  • Create a new cogl program object that can be used to replace parts of the GL rendering pipeline with custom code.

    Returns Cogl.Handle

  • Create a new shader handle, use cogl_shader_source() to set the source code to be used on it.

    Parameters

    • shaderType: Cogl.ShaderType

      COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT.

    Returns Cogl.Handle

  • disableFog(): void
  • This function disables fogging, so primitives drawn afterwards will not be blended with any previously set fog color.

    Returns void

  • doubleToInt(value: number): number
  • doubleToUint(value: number): number
  • endGl(): void
  • This is the counterpart to cogl_begin_gl() used to delimit blocks of drawing code using raw OpenGL. Please refer to cogl_begin_gl() for full details.

    Returns void

  • Checks whether the given COGL features are available. Multiple features can be checked for by or-ing them together with the '|' operator. %TRUE is only returned if all of the requested features are available.

    Parameters

    Returns Cogl.Bool

  • flush(): void
  • This function should only need to be called in exceptional circumstances.

    As an optimization Cogl drawing functions may batch up primitives internally, so if you are trying to use raw GL outside of Cogl you stand a better chance of being successful if you ask Cogl to flush any batched geometry before making your state changes.

    It only ensure that the underlying driver is issued all the commands necessary to draw the batched primitives. It provides no guarantees about when the driver will complete the rendering.

    This provides no guarantees about the GL state upon returning and to avoid confusing Cogl you should aim to restore any changes you make before resuming use of Cogl.

    If you are making state changes with the intention of affecting Cogl drawing primitives you are 100% on your own since you stand a good chance of conflicting with Cogl internals. For example clutter-gst which currently uses direct GL calls to bind ARBfp programs will very likely break when Cogl starts to use ARBfb programs itself for the material API.

    Returns void

  • frustum(left: number, right: number, bottom: number, top: number, zNear: number, zFar: number): void
  • Replaces the current projection matrix with a perspective matrix for a given viewing frustum defined by 4 side clip planes that all cross through the origin and 2 near and far clip planes.

    Parameters

    • left: number

      X position of the left clipping plane where it intersects the near clipping plane

    • right: number

      X position of the right clipping plane where it intersects the near clipping plane

    • bottom: number

      Y position of the bottom clipping plane where it intersects the near clipping plane

    • top: number

      Y position of the top clipping plane where it intersects the near clipping plane

    • zNear: number

      The distance to the near clipping plane (Must be positive)

    • zFar: number

      The distance to the far clipping plane (Must be positive)

    Returns void

  • Queries if backface culling has been enabled via cogl_set_backface_culling_enabled()

    Returns Cogl.Bool

  • getBitmasks(): [number, number, number, number]
  • Gets the number of bitplanes used for each of the color components in the color buffer. Pass %NULL for any of the arguments if the value is not required.

    Returns [number, number, number, number]

  • Retrieves the #GOptionGroup used by Cogl to parse the command line options. Clutter uses this to handle the Cogl command line options during its initialization process.

    Returns OptionGroup

  • getSource(): object | null
  • Returns the current source material as previously set using cogl_set_source().

    You should typically consider the returned material immutable and not try to change any of its properties unless you own a reference to that material. At times you may be able to get a reference to an internally managed materials and the result of modifying such materials is undefined.

    Returns object | null

  • getViewport(): number[]
  • Stores the current viewport in v. v[0] and v[1] get the x and y position of the viewport and v[2] and v[3] get the width and height.

    Returns number[]

  • gtypeMatrixGetType(): GType
  • handleUnref(handle: object): void
  • Drecreases the reference count of handle by 1; if the reference count reaches 0, the resources allocated by handle will be freed

    Parameters

    • handle: object

      a #CoglHandle

    Returns void

  • Checks whether object is a #CoglBitmap

    Parameters

    • object: object

      a #CoglObject pointer

    Returns Cogl.Bool

  • Gets whether the given handle references an existing material object.

    Parameters

    • handle: object

      A CoglHandle

    Returns Cogl.Bool

  • Determines whether the given #CoglObject references an offscreen framebuffer object.

    Parameters

    • object: object

      A pointer to a #CoglObject

    Returns Cogl.Bool

  • Gets whether the given handle references an existing program object.

    Parameters

    • handle: object

      A CoglHandle

    Returns Cogl.Bool

  • Gets whether the given handle references an existing shader object.

    Parameters

    • handle: object

      A CoglHandle

    Returns Cogl.Bool

  • Gets whether the given object references a texture object.

    Parameters

    • object: object

      A #CoglObject pointer

    Returns Cogl.Bool

  • isVertexBuffer(handle: object): Cogl.Bool
  • Checks whether handle is a Vertex Buffer Object

    Parameters

    • handle: object

      a #CoglHandle for a vertex buffer object

    Returns Cogl.Bool

  • isVertexBufferIndices(handle: object): Cogl.Bool
  • Checks whether handle is a handle to the indices for a vertex buffer object

    Parameters

    • handle: object

      a #CoglHandle

    Returns Cogl.Bool

  • Increment the reference count for a #CoglMaterial.

    Parameters

    • material: object

      a #CoglMaterial object.

    Returns Cogl.Handle

  • materialUnref(material: object): void
  • Decrement the reference count for a #CoglMaterial.

    Parameters

    • material: object

      a #CoglMaterial object.

    Returns void

  • matrixEqual(v1: object, v2: object): Cogl.Bool
  • Compares two matrices to see if they represent the same transformation. Although internally the matrices may have different annotations associated with them and may potentially have a cached inverse matrix these are not considered in the comparison.

    Parameters

    • v1: object

      A 4x4 transformation matrix

    • v2: object

      A 4x4 transformation matrix

    Returns Cogl.Bool

  • onscreenClutterBackendSetSizeCLUTTER(width: number, height: number): void
  • ortho(left: number, right: number, bottom: number, top: number, near: number, far: number): void
  • Replaces the current projection matrix with an orthographic projection matrix. See to see how the matrix is calculated.

    This function copies the arguments from OpenGL's glOrtho() even though they are unnecessarily confusing due to the z near and z far arguments actually being a "distance" from the origin, where negative values are behind the viewer, instead of coordinates for the z clipping planes which would have been consistent with the left, right bottom and top arguments.

    Parameters

    • left: number

      The coordinate for the left clipping plane

    • right: number

      The coordinate for the right clipping plane

    • bottom: number

      The coordinate for the bottom clipping plane

    • top: number

      The coordinate for the top clipping plane

    • near: number

      The distance to the near clipping plane (negative if the plane is behind the viewer)

    • far: number

      The distance for the far clipping plane (negative if the plane is behind the viewer)

    Returns void

  • perspective(fovy: number, aspect: number, zNear: number, zFar: number): void
  • Replaces the current projection matrix with a perspective matrix based on the provided values.

    You should be careful not to have to great a z_far / z_near ratio since that will reduce the effectiveness of depth testing since there wont be enough precision to identify the depth of objects near to each other.

    Parameters

    • fovy: number

      Vertical field of view angle in degrees.

    • aspect: number

      The (width over height) aspect ratio for display

    • zNear: number

      The distance to the near clipping plane (Must be positive)

    • zFar: number

      The distance to the far clipping plane (Must be positive)

    Returns void

  • Draws a convex polygon using the current source material to fill / texture with according to the texture coordinates passed.

    If use_color is %TRUE then the color will be changed for each vertex using the value specified in the color member of #CoglTextureVertex. This can be used for example to make the texture fade out by setting the alpha value of the color.

    All of the texture coordinates must be in the range [0,1] and repeating the texture is not supported.

    Because of the way this function is implemented it will currently only work if either the texture is not sliced or the backend is not OpenGL ES and the minifying and magnifying functions are both set to COGL_MATERIAL_FILTER_NEAREST.

    Parameters

    • vertices: Cogl.TextureVertex

      An array of #CoglTextureVertex structs

    • nVertices: number

      The length of the vertices array

    • useColor: number

      %TRUE if the color member of #CoglTextureVertex should be used

    Returns void

  • popDrawBuffer(): void
  • popFramebuffer(): void
  • Restores the framebuffer that was previously at the top of the stack. All subsequent drawing will be redirected to this framebuffer.

    Returns void

  • popMatrix(): void
  • Restores the current model-view matrix from the matrix stack.

    Returns void

  • popSource(): void
  • Removes the material at the top of the source stack. The material at the top of this stack defines the GPU state used to process later primitives as defined by cogl_set_source().

    Returns void

  • programAttachShader(programHandle: object, shaderHandle: object): void
  • Attaches a shader to a program object. A program can have multiple vertex or fragment shaders but only one of them may provide a main() function. It is allowed to use a program with only a vertex shader or only a fragment shader.

    Parameters

    • programHandle: object

      a #CoglHandle for a shdaer program.

    • shaderHandle: object

      a #CoglHandle for a vertex of fragment shader.

    Returns void

  • programGetUniformLocation(handle: object, uniformName: string): number
  • Retrieve the location (offset) of a uniform variable in a shader program, a uniform is a variable that is constant for all vertices/fragments for a shader object and is possible to modify as an external parameter.

    Parameters

    • handle: object

      a #CoglHandle for a shader program.

    • uniformName: string

      the name of a uniform.

    Returns number

  • programLink(handle: object): void
  • Links a program making it ready for use. Note that calling this function is optional. If it is not called the program will automatically be linked the first time it is used.

    Parameters

    • handle: object

      a #CoglHandle for a shader program.

    Returns void

  • programSetUniform1f(program: object, uniformLocation: number, value: number): void
  • Changes the value of a floating point uniform for the given linked program.

    Parameters

    • program: object

      A #CoglHandle for a linked program

    • uniformLocation: number

      the uniform location retrieved from cogl_program_get_uniform_location().

    • value: number

      the new value of the uniform.

    Returns void

  • programSetUniform1i(program: object, uniformLocation: number, value: number): void
  • Changes the value of an integer uniform for the given linked program.

    Parameters

    • program: object

      A #CoglHandle for a linked program

    • uniformLocation: number

      the uniform location retrieved from cogl_program_get_uniform_location().

    • value: number

      the new value of the uniform.

    Returns void

  • programSetUniformFloat(program: object, uniformLocation: number, nComponents: number, value: number[]): void
  • Changes the value of a float vector uniform, or uniform array for the given linked program.

    Parameters

    • program: object

      A #CoglHandle for a linked program

    • uniformLocation: number

      the uniform location retrieved from cogl_program_get_uniform_location().

    • nComponents: number

      The number of components for the uniform. For example with glsl you'd use 3 for a vec3 or 4 for a vec4.

    • value: number[]

      the new value of the uniform[s].

    Returns void

  • programSetUniformInt(program: object, uniformLocation: number, nComponents: number, value: number[]): void
  • Changes the value of a int vector uniform, or uniform array for the given linked program.

    Parameters

    • program: object

      A #CoglHandle for a linked program

    • uniformLocation: number

      the uniform location retrieved from cogl_program_get_uniform_location().

    • nComponents: number

      The number of components for the uniform. For example with glsl you'd use 3 for a vec3 or 4 for a vec4.

    • value: number[]

      the new value of the uniform[s].

    Returns void

  • programSetUniformMatrix(program: object, uniformLocation: number, dimensions: number, transpose: number, value: number[]): void
  • Changes the value of a matrix uniform, or uniform array in the given linked program.

    Parameters

    • program: object

      A #CoglHandle for a linked program

    • uniformLocation: number

      the uniform location retrieved from cogl_program_get_uniform_location().

    • dimensions: number

      The dimensions of the matrix. So for for example pass 2 for a 2x2 matrix or 3 for 3x3.

    • transpose: number

      Whether to transpose the matrix when setting the uniform.

    • value: number[]

      the new value of the uniform.

    Returns void

  • programUniform1f(uniformNo: number, value: number): void
  • Changes the value of a floating point uniform in the currently used (see cogl_program_use()) shader program.

    Parameters

    • uniformNo: number

      the uniform to set.

    • value: number

      the new value of the uniform.

    Returns void

  • programUniform1i(uniformNo: number, value: number): void
  • Changes the value of an integer uniform in the currently used (see cogl_program_use()) shader program.

    Parameters

    • uniformNo: number

      the uniform to set.

    • value: number

      the new value of the uniform.

    Returns void

  • programUniformFloat(uniformNo: number, size: number, value: number[]): void
  • Changes the value of a float vector uniform, or uniform array in the currently used (see cogl_program_use()) shader program.

    Parameters

    • uniformNo: number

      the uniform to set.

    • size: number

      Size of float vector.

    • value: number[]

      the new value of the uniform.

    Returns void

  • programUniformInt(uniformNo: number, size: number, value: number[]): void
  • Changes the value of a int vector uniform, or uniform array in the currently used (see cogl_program_use()) shader program.

    Parameters

    • uniformNo: number

      the uniform to set.

    • size: number

      Size of int vector.

    • value: number[]

      the new value of the uniform.

    Returns void

  • programUniformMatrix(uniformNo: number, size: number, transpose: number, value: number[]): void
  • Changes the value of a matrix uniform, or uniform array in the currently used (see cogl_program_use()) shader program. The size parameter is used to determine the square size of the matrix.

    Parameters

    • uniformNo: number

      the uniform to set.

    • size: number

      Size of matrix.

    • transpose: number

      Whether to transpose the matrix when setting the uniform.

    • value: number[]

      the new value of the uniform.

    Returns void

  • programUnref(handle: object): void
  • Removes a reference to a program. If it was the last reference the program object will be destroyed.

    Parameters

    • handle: object

      A #CoglHandle to a program.

    Returns void

  • programUse(handle: object): void
  • Activate a specific shader program replacing that part of the GL rendering pipeline, if passed in %COGL_INVALID_HANDLE the default behavior of GL is reinstated.

    This function affects the global state of the current Cogl context. It is much more efficient to attach the shader to a specific material used for rendering instead by calling cogl_material_set_user_program().

    Parameters

    • handle: object

      a #CoglHandle for a shader program or %COGL_INVALID_HANDLE.

    Returns void

  • pushDrawBuffer(): void
  • pushMatrix(): void
  • Stores the current model-view matrix on the matrix stack. The matrix can later be restored with cogl_pop_matrix().

    Returns void

  • pushSource(material: object): void
  • Pushes the given material to the top of the source stack. The material at the top of this stack defines the GPU state used to process later primitives as defined by cogl_set_source().

    Parameters

    • material: object

      A #CoglMaterial

    Returns void

  • This reads a rectangle of pixels from the current framebuffer where position (0, 0) is the top left. The pixel at (x, y) is the first read, and the data is returned with a rowstride of (width * 4).

    Currently Cogl assumes that the framebuffer is in a premultiplied format so if format is non-premultiplied it will convert it. To read the pixel values without any conversion you should either specify a format that doesn't use an alpha channel or use one of the formats ending in PRE.

    Parameters

    • x: number

      The window x position to start reading from

    • y: number

      The window y position to start reading from

    • width: number

      The width of the rectangle you want to read

    • height: number

      The height of the rectangle you want to read

    • source: Cogl.ReadPixelsFlags

      Identifies which auxillary buffer you want to read (only COGL_READ_PIXELS_COLOR_BUFFER supported currently)

    • format: Cogl.PixelFormat

      The pixel format you want the result in (only COGL_PIXEL_FORMAT_RGBA_8888 supported currently)

    • pixels: number

      The location to write the pixel data.

    Returns void

  • rectangle(x1: number, y1: number, x2: number, y2: number): void
  • Fills a rectangle at the given coordinates with the current source material

    Parameters

    • x1: number

      X coordinate of the top-left corner

    • y1: number

      Y coordinate of the top-left corner

    • x2: number

      X coordinate of the bottom-right corner

    • y2: number

      Y coordinate of the bottom-right corner

    Returns void

  • rectangleWithMultitextureCoords(x1: number, y1: number, x2: number, y2: number, texCoords: number[], texCoordsLen: number): void
  • This function draws a rectangle using the current source material to texture or fill with. As a material may contain multiple texture layers this interface lets you supply texture coordinates for each layer of the material.

    The first pair of coordinates are for the first layer (with the smallest layer index) and if you supply less texture coordinates than there are layers in the current source material then default texture coordinates (0.0, 0.0, 1.0, 1.0) are generated.

    Parameters

    • x1: number

      x coordinate upper left on screen.

    • y1: number

      y coordinate upper left on screen.

    • x2: number

      x coordinate lower right on screen.

    • y2: number

      y coordinate lower right on screen.

    • texCoords: number[]

      An array containing groups of 4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture coordinates; one for the upper left texel, and one for the lower right texel. Each value should be between 0.0 and 1.0, where the coordinate (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the bottom right.

    • texCoordsLen: number

      The length of the tex_coords array. (e.g. for one layer and one group of texture coordinates, this would be 4)

    Returns void

  • rectangleWithTextureCoords(x1: number, y1: number, x2: number, y2: number, tx1: number, ty1: number, tx2: number, ty2: number): void
  • Draw a rectangle using the current material and supply texture coordinates to be used for the first texture layer of the material. To draw the entire texture pass in tx1=0.0 ty1=0.0 tx2=1.0 ty2=1.0.

    Parameters

    • x1: number

      x coordinate upper left on screen.

    • y1: number

      y coordinate upper left on screen.

    • x2: number

      x coordinate lower right on screen.

    • y2: number

      y coordinate lower right on screen.

    • tx1: number

      x part of texture coordinate to use for upper left pixel

    • ty1: number

      y part of texture coordinate to use for upper left pixel

    • tx2: number

      x part of texture coordinate to use for lower right pixel

    • ty2: number

      y part of texture coordinate to use for left pixel

    Returns void

  • rectangles(verts: number[], nRects: number): void
  • Draws a series of rectangles in the same way that cogl_rectangle() does. In some situations it can give a significant performance boost to use this function rather than calling cogl_rectangle() separately for each rectangle.

    verts should point to an array of #floats with n_rects * 4 elements. Each group of 4 values corresponds to the parameters x1, y1, x2, and y2, and have the same meaning as in cogl_rectangle().

    Parameters

    • verts: number[]

      an array of vertices

    • nRects: number

      number of rectangles to draw

    Returns void

  • rectanglesWithTextureCoords(verts: number[], nRects: number): void
  • Draws a series of rectangles in the same way that cogl_rectangle_with_texture_coords() does. In some situations it can give a significant performance boost to use this function rather than calling cogl_rectangle_with_texture_coords() separately for each rectangle.

    verts should point to an array of #floats with n_rects * 8 elements. Each group of 8 values corresponds to the parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same meaning as in cogl_rectangle_with_texture_coords().

    Parameters

    • verts: number[]

      an array of vertices

    • nRects: number

      number of rectangles to draw

    Returns void

  • rotate(angle: number, x: number, y: number, z: number): void
  • Multiplies the current model-view matrix by one that rotates the model around the vertex specified by x, y and z. The rotation follows the right-hand thumb rule so for example rotating by 10 degrees about the vertex (0, 0, 1) causes a small counter-clockwise rotation.

    Parameters

    • angle: number

      Angle in degrees to rotate.

    • x: number

      X-component of vertex to rotate around.

    • y: number

      Y-component of vertex to rotate around.

    • z: number

      Z-component of vertex to rotate around.

    Returns void

  • scale(x: number, y: number, z: number): void
  • Multiplies the current model-view matrix by one that scales the x, y and z axes by the given values.

    Parameters

    • x: number

      Amount to scale along the x-axis

    • y: number

      Amount to scale along the y-axis

    • z: number

      Amount to scale along the z-axis

    Returns void

  • setBackfaceCullingEnabled(setting: number): void
  • Sets whether textures positioned so that their backface is showing should be hidden. This can be used to efficiently draw two-sided textures or fully closed cubes without enabling depth testing. This only affects calls to the cogl_rectangle* family of functions and cogl_vertex_buffer_draw*. Backface culling is disabled by default.

    Parameters

    • setting: number

      %TRUE to enable backface culling or %FALSE to disable.

    Returns void

  • setDepthTestEnabled(setting: number): void
  • Sets whether depth testing is enabled. If it is disabled then the order that actors are layered on the screen depends solely on the order specified using clutter_actor_raise() and clutter_actor_lower(), otherwise it will also take into account the actor's depth. Depth testing is disabled by default.

    Parameters

    • setting: number

      %TRUE to enable depth testing or %FALSE to disable.

    Returns void

  • Redirects all subsequent drawing to the specified framebuffer. This can either be an offscreen buffer created with cogl_offscreen_new_to_texture () or you can revert to your original on screen window buffer.

    Parameters

    • target: Cogl.BufferTarget

      A #CoglBufferTarget that specifies what kind of framebuffer you are setting as the render target.

    • offscreen: object

      If you are setting a framebuffer of type COGL_OFFSCREEN_BUFFER then this is a CoglHandle for the offscreen buffer.

    Returns void

  • setFog(fogColor: Cogl.Color, mode: Cogl.FogMode, density: number, zNear: number, zFar: number): void
  • Enables fogging. Fogging causes vertices that are further away from the eye to be rendered with a different color. The color is determined according to the chosen fog mode; at it's simplest the color is linearly interpolated so that vertices at z_near are drawn fully with their original color and vertices at z_far are drawn fully with fog_color. Fogging will remain enabled until you call cogl_disable_fog().

    The fogging functions only work correctly when primitives use unmultiplied alpha colors. By default Cogl will premultiply textures and cogl_set_source_color() will premultiply colors, so unless you explicitly load your textures requesting an unmultiplied internal format and use cogl_material_set_color() you can only use fogging with fully opaque primitives. This might improve in the future when we can depend on fragment shaders.

    Parameters

    • fogColor: Cogl.Color

      The color of the fog

    • mode: Cogl.FogMode

      A #CoglFogMode that determines the equation used to calculate the fogging blend factor.

    • density: number

      Used by %COGL_FOG_MODE_EXPONENTIAL and by %COGL_FOG_MODE_EXPONENTIAL_SQUARED equations.

    • zNear: number

      Position along Z axis where no fogging should be applied

    • zFar: number

      Position along Z axis where full fogging should be applied

    Returns void

  • Loads matrix as the new model-view matrix.

    Parameters

    Returns void

  • Loads matrix as the new projection matrix.

    Parameters

    Returns void

  • setSource(material: object): void
  • This function changes the material at the top of the source stack. The material at the top of this stack defines the GPU state used to process subsequent primitives, such as rectangles drawn with cogl_rectangle() or vertices drawn using cogl_vertex_buffer_draw().

    Parameters

    • material: object

      A #CoglMaterial

    Returns void

  • This is a convenience function for creating a solid fill source material from the given color. This color will be used for any subsequent drawing operation.

    The color will be premultiplied by Cogl, so the color should be non-premultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for semi-transparent red.

    See also cogl_set_source_color4ub() and cogl_set_source_color4f() if you already have the color components.

    Parameters

    Returns void

  • setSourceColor4f(red: number, green: number, blue: number, alpha: number): void
  • This is a convenience function for creating a solid fill source material from the given color using normalized values for each component. This color will be used for any subsequent drawing operation.

    The value for each component is a fixed point number in the range between 0 and %1.0. If the values passed in are outside that range, they will be clamped.

    Parameters

    • red: number

      value of the red channel, between 0 and %1.0

    • green: number

      value of the green channel, between 0 and %1.0

    • blue: number

      value of the blue channel, between 0 and %1.0

    • alpha: number

      value of the alpha channel, between 0 and %1.0

    Returns void

  • setSourceColor4ub(red: number, green: number, blue: number, alpha: number): void
  • This is a convenience function for creating a solid fill source material from the given color using unsigned bytes for each component. This color will be used for any subsequent drawing operation.

    The value for each component is an unsigned byte in the range between 0 and 255.

    Parameters

    • red: number

      value of the red channel, between 0 and 255

    • green: number

      value of the green channel, between 0 and 255

    • blue: number

      value of the blue channel, between 0 and 255

    • alpha: number

      value of the alpha channel, between 0 and 255

    Returns void

  • This is a convenience function for creating a material with the first layer set to texture and setting that material as the source with cogl_set_source.

    Note: There is no interaction between calls to cogl_set_source_color and cogl_set_source_texture. If you need to blend a texture with a color then you can create a simple material like this: material = cogl_material_new (); cogl_material_set_color4ub (material, 0xff, 0x00, 0x00, 0x80); cogl_material_set_layer (material, 0, tex_handle); cogl_set_source (material);

    Parameters

    • texture: Cogl.Texture

      The #CoglTexture you want as your source

    Returns void

  • setViewport(x: number, y: number, width: number, height: number): void
  • Replaces the current viewport with the given values.

    Parameters

    • x: number

      X offset of the viewport

    • y: number

      Y offset of the viewport

    • width: number

      Width of the viewport

    • height: number

      Height of the viewport

    Returns void

  • shaderCompile(handle: object): void
  • Compiles the shader, no return value, but the shader is now ready for linking into a program. Note that calling this function is optional. If it is not called then the shader will be automatically compiled when it is linked.

    Parameters

    • handle: object

      #CoglHandle for a shader.

    Returns void

  • shaderGetInfoLog(handle: object): string
  • Retrieves the information log for a coglobject, can be used in conjunction with cogl_shader_get_parameteriv() to retrieve the compiler warnings/error messages that caused a shader to not compile correctly, mainly useful for debugging purposes.

    Parameters

    • handle: object

      #CoglHandle for a shader.

    Returns string

  • shaderIsCompiled(handle: object): Cogl.Bool
  • Retrieves whether a shader #CoglHandle has been compiled

    Parameters

    • handle: object

      #CoglHandle for a shader.

    Returns Cogl.Bool

  • shaderSource(shader: object, source: string): void
  • Replaces the current source associated with a shader with a new one.

    Please see above for a description of the recommended format for the shader code.

    Parameters

    • shader: object

      #CoglHandle for a shader.

    • source: string

      Shader source.

    Returns void

  • shaderUnref(handle: object): void
  • Removes a reference to a shader. If it was the last reference the shader object will be destroyed.

    Parameters

    • handle: object

      A #CoglHandle to a shader.

    Returns void

  • sqrti(x: number): number
  • Very fast fixed point implementation of square root for integers.

    This function is at least 6x faster than clib sqrt() on x86, and (this is not a typo!) about 500x faster on ARM without FPU. It's error is less than 5% for arguments smaller than %COGL_SQRTI_ARG_5_PERCENT and less than 10% for narguments smaller than %COGL_SQRTI_ARG_10_PERCENT. The maximum argument that can be passed to this function is %COGL_SQRTI_ARG_MAX.

    Parameters

    • x: number

      integer value

    Returns number

  • textureErrorQuark(): number
  • Multiplies the current model-view matrix by the given matrix.

    Parameters

    • matrix: Cogl.Matrix

      the matrix to multiply with the current model-view

    Returns void

  • translate(x: number, y: number, z: number): void
  • Multiplies the current model-view matrix by one that translates the model along all three axes according to the given values.

    Parameters

    • x: number

      Distance to translate along the x-axis

    • y: number

      Distance to translate along the y-axis

    • z: number

      Distance to translate along the z-axis

    Returns void

  • vertexBufferAdd(handle: object, attributeName: string, nComponents: number, type: Cogl.AttributeType, normalized: number, stride: number, pointer: object): void
  • Adds an attribute to a buffer, or replaces a previously added attribute with the same name.

    You either can use one of the built-in names such as "gl_Vertex", or "gl_MultiTexCoord0" to add standard attributes, like positions, colors and normals, or you can add custom attributes for use in shaders.

    The number of vertices declared when calling cogl_vertex_buffer_new() determines how many attribute values will be read from the supplied pointer.

    The data for your attribute isn't copied anywhere until you call cogl_vertex_buffer_submit(), or issue a draw call which automatically submits pending attribute changes. so the supplied pointer must remain valid until then. If you are updating an existing attribute (done by re-adding it) then you still need to re-call cogl_vertex_buffer_submit() to commit the changes to the GPU. Be carefull to minimize the number of calls to cogl_vertex_buffer_submit(), though.

    If you are interleving attributes it is assumed that each interleaved attribute starts no farther than +- stride bytes from the other attributes it is interleved with. I.e. this is ok: |-0-0-0-0-0-0-0-0-0-0| This is not ok: |- - - - -0-0-0-0-0-0 0 0 0 0| (Though you can have multiple groups of interleved attributes)

    Parameters

    • handle: object

      A vertex buffer handle

    • attributeName: string

      The name of your attribute. It should be a valid GLSL variable name and standard attribute types must use one of following built-in names: (Note: they correspond to the built-in names of GLSL) "gl_Color" "gl_Normal" "gl_MultiTexCoord0, gl_MultiTexCoord1, ..." "gl_Vertex" To support adding multiple variations of the same attribute the name can have a detail component, E.g. "gl_Color::active" or "gl_Color::inactive"

    • nComponents: number

      The number of components per attribute and must be 1, 2, 3 or 4

    • type: Cogl.AttributeType

      a #CoglAttributeType specifying the data type of each component.

    • normalized: number

      If %TRUE, this specifies that values stored in an integer format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0] for unsigned values. If %FALSE they are converted to floats directly.

    • stride: number

      This specifies the number of bytes from the start of one attribute value to the start of the next value (for the same attribute). So, for example, with a position interleved with color like this: XYRGBAXYRGBAXYRGBA, then if each letter represents a byte, the stride for both attributes is 6. The special value 0 means the values are stored sequentially in memory.

    • pointer: object

      This addresses the first attribute in the vertex array. This must remain valid until you either call cogl_vertex_buffer_submit() or issue a draw call.

    Returns void

  • vertexBufferDelete(handle: object, attributeName: string): void
  • Deletes an attribute from a buffer. You will need to call cogl_vertex_buffer_submit() or issue a draw call to commit this change to the GPU.

    Parameters

    • handle: object

      A vertex buffer handle

    • attributeName: string

      The name of a previously added attribute

    Returns void

  • vertexBufferDisable(handle: object, attributeName: string): void
  • Disables a previosuly added attribute.

    Since it can be costly to add and remove new attributes to buffers; to make individual buffers more reuseable it is possible to enable and disable attributes before using a buffer for drawing.

    You don't need to call cogl_vertex_buffer_submit() after using this function.

    Parameters

    • handle: object

      A vertex buffer handle

    • attributeName: string

      The name of the attribute you want to disable

    Returns void

  • vertexBufferDraw(handle: object, mode: Cogl.VerticesMode, first: number, count: number): void
  • Allows you to draw geometry using all or a subset of the vertices in a vertex buffer.

    Any un-submitted attribute changes are automatically submitted before drawing.

    Parameters

    • handle: object

      A vertex buffer handle

    • mode: Cogl.VerticesMode

      A #CoglVerticesMode specifying how the vertices should be interpreted.

    • first: number

      Specifies the index of the first vertex you want to draw with

    • count: number

      Specifies the number of vertices you want to draw.

    Returns void

  • vertexBufferDrawElements(handle: object, mode: Cogl.VerticesMode, indices: object, minIndex: number, maxIndex: number, indicesOffset: number, count: number): void
  • This function lets you use an array of indices to specify the vertices within your vertex buffer that you want to draw. The indices themselves are created by calling cogl_vertex_buffer_indices_new ()

    Any un-submitted attribute changes are automatically submitted before drawing.

    Parameters

    • handle: object

      A vertex buffer handle

    • mode: Cogl.VerticesMode

      A #CoglVerticesMode specifying how the vertices should be interpreted.

    • indices: object

      A CoglHandle for a set of indices allocated via cogl_vertex_buffer_indices_new ()

    • minIndex: number

      Specifies the minimum vertex index contained in indices

    • maxIndex: number

      Specifies the maximum vertex index contained in indices

    • indicesOffset: number

      An offset into named indices. The offset marks the first index to use for drawing.

    • count: number

      Specifies the number of vertices you want to draw.

    Returns void

  • vertexBufferEnable(handle: object, attributeName: string): void
  • Enables a previosuly disabled attribute.

    Since it can be costly to add and remove new attributes to buffers; to make individual buffers more reuseable it is possible to enable and disable attributes before using a buffer for drawing.

    You don't need to call cogl_vertex_buffer_submit() after using this function

    Parameters

    • handle: object

      A vertex buffer handle

    • attributeName: string

      The name of the attribute you want to enable

    Returns void

  • vertexBufferGetNVertices(handle: object): number
  • Retrieves the number of vertices that handle represents

    Parameters

    • handle: object

      A vertex buffer handle

    Returns number

  • vertexBufferIndicesGetForQuads(nIndices: number): Cogl.Handle
  • Creates a vertex buffer containing the indices needed to draw pairs of triangles from a list of vertices grouped as quads. There will be at least n_indices entries in the buffer (but there may be more).

    The indices will follow this pattern:

    0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 ... etc

    For example, if you submit vertices for a quad like like that shown in then you can request 6 indices to render two triangles like those shown in .

    Example of vertices submitted to form a quad
    Illustration of the triangle indices that will be generated

    Parameters

    • nIndices: number

      the number of indices in the vertex buffer.

    Returns Cogl.Handle

  • Creates a new vertex buffer that you can use to add attributes.

    Parameters

    • nVertices: number

      The number of vertices that your attributes will correspond to.

    Returns Cogl.Handle

  • vertexBufferSubmit(handle: object): void
  • Submits all the user added attributes to the GPU; once submitted, the attributes can be used for drawing.

    You should aim to minimize calls to this function since it implies validating your data; it potentially incurs a transport cost (especially if you are using GLX indirect rendering) and potentially a format conversion cost if the GPU doesn't natively support any of the given attribute formats.

    Parameters

    • handle: object

      A vertex buffer handle

    Returns void

  • vertexBufferUnref(handle: object): void
  • Decrement the reference count for a vertex buffer

    Parameters

    • handle: object

      a CoglHandle.

    Returns void

  • viewport(width: number, height: number): void
  • Replace the current viewport with the given values.

    Parameters

    • width: number

      Width of the viewport

    • height: number

      Height of the viewport

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method