Gjsify LogoGjsify Logo

Hierarchy

Index

Constructors

Properties

Methods

Constructors

  • Parameters

    Returns Onscreen

  • Instantiates an "unallocated" #CoglOnscreen framebuffer that may be configured before later being allocated, either implicitly when it is first used or explicitly via cogl_framebuffer_allocate().

    Parameters

    • context: Cogl.Context

      A #CoglContext

    • width: number

      The desired framebuffer width

    • height: number

      The desired framebuffer height

    Returns Onscreen

Properties

gTypeInstance: TypeInstance
$gtype: GType<Onscreen>
name: string

Methods

  • Installs a callback function that will be called whenever the window system has lost the contents of a region of the onscreen buffer and the application should redraw it to repair the buffer. For example this may happen in a window system without a compositor if a window that was previously covering up the onscreen window has been moved causing a region of the onscreen to be exposed.

    The callback will be passed a #CoglOnscreenDirtyInfo struct which decribes a rectangle containing the newly dirtied region. Note that this may be called multiple times to describe a non-rectangular region composed of multiple smaller rectangles.

    The dirty events are separate from %COGL_FRAME_EVENT_SYNC events so the application should also listen for this event before rendering the dirty region to ensure that the framebuffer is actually ready for rendering.

    Parameters

    • callback: OnscreenDirtyCallback

      A callback function to call for dirty events

    • destroy: GLib.DestroyNotify

      An optional callback to destroy user_data when the callback is removed or onscreen is freed.

    Returns OnscreenDirtyClosure

  • Installs a callback function that will be called for significant events relating to the given onscreen framebuffer.

    The callback will be used to notify when the system compositor is ready for this application to render a new frame. In this case %COGL_FRAME_EVENT_SYNC will be passed as the event argument to the given callback in addition to the #CoglFrameInfo corresponding to the frame beeing acknowledged by the compositor.

    The callback will also be called to notify when the frame has ended. In this case %COGL_FRAME_EVENT_COMPLETE will be passed as the event argument to the given callback in addition to the #CoglFrameInfo corresponding to the newly presented frame. The meaning of "ended" here simply means that no more timing information will be collected within the corresponding #CoglFrameInfo and so this is a good opportunity to analyse the given info. It does not necessarily mean that the GPU has finished rendering the corresponding frame.

    We highly recommend throttling your application according to %COGL_FRAME_EVENT_SYNC events so that your application can avoid wasting resources, drawing more frames than your system compositor can display.

    Parameters

    • callback: FrameCallback

      A callback function to call for frame events

    • destroy: GLib.DestroyNotify

      An optional callback to destroy user_data when the callback is removed or onscreen is freed.

    Returns FrameClosure

  • Registers a callback with onscreen that will be called whenever the onscreen framebuffer changes size.

    The callback can be removed using cogl_onscreen_remove_resize_callback() passing the returned closure pointer.

    Since Cogl automatically updates the viewport of an onscreen framebuffer that is resized, a resize callback can also be used to track when the viewport has been changed automatically by Cogl in case your application needs more specialized control over the viewport.

    A resize callback will only ever be called while dispatching Cogl events from the system mainloop; so for example during cogl_poll_renderer_dispatch(). This is so that callbacks shouldn't occur while an application might have arbitrary locks held for example.

    Parameters

    • callback: OnscreenResizeCallback

      A #CoglOnscreenResizeCallback to call when the onscreen changes size.

    • destroy: GLib.DestroyNotify

      An optional callback to destroy user_data when the callback is removed or onscreen is freed.

    Returns OnscreenResizeClosure

  • Installs a callback function that should be called whenever a swap buffers request (made using cogl_onscreen_swap_buffers()) for the given onscreen completes.

    Applications should check for the %COGL_FEATURE_ID_SWAP_BUFFERS_EVENT feature before using this API. It's currently undefined when and if registered callbacks will be called if this feature is not supported.

    We recommend using this mechanism when available to manually throttle your applications (in conjunction with cogl_onscreen_set_swap_throttled()) so your application will be able to avoid long blocks in the driver caused by throttling when you request to swap buffers too quickly.

    Parameters

    Returns number

  • allocate(): number
  • Explicitly allocates a configured #CoglFramebuffer allowing developers to check and handle any errors that might arise from an unsupported configuration so that fallback configurations may be tried.

    Many applications don't support any fallback options at least when they are initially developed and in that case the don't need to use this API since Cogl will automatically allocate a framebuffer when it first gets used. The disadvantage of relying on automatic allocation is that the program will abort with an error message if there is an error during automatic allocation.

    Returns number

  • Creates a binding between source_property on source and target_property on target.

    Whenever the source_property is changed the target_property is updated using the same value. For instance:

      g_object_bind_property (action, "active", widget, "sensitive", 0);
    

    Will result in the "sensitive" property of the widget #GObject instance to be updated with the same value of the "active" property of the action #GObject instance.

    If flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.

    The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call g_object_unref() on the returned #GBinding instance.

    Removing the binding by calling g_object_unref() on it must only be done if the binding, source and target are only used from a single thread and it is clear that both source and target outlive the binding. Especially it is not safe to rely on this if the binding, source or target can be finalized from different threads. Keep another reference to the binding and use g_binding_unbind() instead to be on the safe side.

    A #GObject can have multiple bindings.

    Parameters

    • sourceProperty: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • targetProperty: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    Returns Binding

  • Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    This function is the language bindings friendly version of g_object_bind_property_full(), using #GClosures instead of function pointers.

    Parameters

    • sourceProperty: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • targetProperty: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    • transformTo: TClosure<any, any>

      a #GClosure wrapping the transformation function from the source to the target, or %NULL to use the default

    • transformFrom: TClosure<any, any>

      a #GClosure wrapping the transformation function from the target to the source, or %NULL to use the default

    Returns Binding

  • Removes a fence previously submitted with cogl_framebuffer_add_fence_callback(); the callback will not be called.

    Parameters

    • closure: FenceClosure

      The #CoglFenceClosure returned from cogl_framebuffer_add_fence_callback()

    Returns void

  • clear(buffers: number, color: Cogl.Color): 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

    • buffers: number

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

    • color: Cogl.Color

      The color to clear the color buffer too if specified in buffers.

    Returns void

  • clear4f(buffers: number, red: number, green: number, blue: number, alpha: 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

    • buffers: number

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

    • red: number

      The red component of color to clear the color buffer too if specified in buffers.

    • green: number

      The green component of color to clear the color buffer too if specified in buffers.

    • blue: number

      The blue component of color to clear the color buffer too if specified in buffers.

    • alpha: number

      The alpha component of color to clear the color buffer too if specified in buffers.

    Returns void

  • connect(sigName: string, callback: ((...args: any[]) => void)): number
  • Parameters

    • sigName: string
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns number

  • discardBuffers(buffers: number): void
  • Declares that the specified buffers no longer need to be referenced by any further rendering commands. This can be an important optimization to avoid subsequent frames of rendering depending on the results of a previous frame.

    For example; some tile-based rendering GPUs are able to avoid allocating and accessing system memory for the depth and stencil buffer so long as these buffers are not required as input for subsequent frames and that can save a significant amount of memory bandwidth used to save and restore their contents to system memory between frames.

    It is currently considered an error to try and explicitly discard the color buffer by passing %COGL_BUFFER_BIT_COLOR. This is because the color buffer is already implicitly discard when you finish rendering to a #CoglOnscreen framebuffer, and it's not meaningful to try and discard the color buffer of a #CoglOffscreen framebuffer since they are single-buffered.

    Parameters

    • buffers: number

      A #CoglBufferBit mask of which ancillary buffers you want to discard.

    Returns void

  • First defines a geometry primitive by grouping a set of vertex attributes; specifying a first_vertex; a number of vertices (n_vertices) and specifying what kind of topology the vertices have via mode.

    Then the function draws the given primitive geometry to the specified destination framebuffer using the graphics processing pipeline described by pipeline.

    The list of #CoglAttributes define the attributes of the vertices to be drawn, such as positions, colors and normals and the number of attributes is given as n_attributes.

    This drawing api doesn't support high-level meta texture types such as #CoglTexture2DSliced so it is the user's responsibility to ensure that only low-level textures that can be directly sampled by a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are associated with layers of the given pipeline.

    This api doesn't support any of the legacy global state options such as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or cogl_program_use()

    Parameters

    • pipeline: Cogl.Pipeline

      A #CoglPipeline state object

    • mode: Cogl.VerticesMode

      The #CoglVerticesMode defining the topology of vertices

    • firstVertex: number

      The vertex offset within the given attributes to draw from

    • nVertices: number

      The number of vertices to draw from the given attributes

    • attributes: Cogl.Attribute

      An array of pointers to #CoglAttribute<-- -->s defining vertex geometry

    • nAttributes: number

      The number of attributes in the attributes array.

    Returns void

  • Behaves the same as cogl_framebuffer_draw_attributes() except that instead of reading vertex data sequentially from the specified attributes the indices provide an indirection for how the data should be indexed allowing a random access order to be specified.

    For example an indices array of [0, 1, 2, 0, 2, 3] could be used used to draw two triangles (mode = %COGL_VERTICES_MODE_TRIANGLES + n_vertices = 6) but only provide attribute data for the 4 corners of a rectangle. When the GPU needs to read in each of the 6 vertices it will read the indices array for each vertex in sequence and use the index to look up the vertex attribute data. So here you can see that first and fourth vertex will point to the same data and third and fifth vertex will also point to shared data.

    Drawing with indices can be a good way of minimizing the size of a mesh by allowing you to avoid data for duplicate vertices because multiple entries in the index array can refer back to a single shared vertex.

    The indices array must be at least as long as first_vertex

    • n_vertices otherwise the GPU will overrun the indices array when looking up vertex data.

    Since it's very common to want to draw a run of rectangles using indices to avoid duplicating vertex data you can use cogl_get_rectangle_indices() to get a set of indices that can be shared.

    This drawing api doesn't support high-level meta texture types such as #CoglTexture2DSliced so it is the user's responsibility to ensure that only low-level textures that can be directly sampled by a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are associated with layers of the given pipeline.

    This api doesn't support any of the legacy global state options such as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or cogl_program_use()

    Parameters

    • pipeline: Cogl.Pipeline

      A #CoglPipeline state object

    • mode: Cogl.VerticesMode

      The #CoglVerticesMode defining the topology of vertices

    • firstVertex: number

      The vertex offset within the given attributes to draw from

    • nVertices: number

      The number of vertices to draw from the given attributes

    • indices: Indices

      The array of indices used by the GPU to lookup attribute data for each vertex.

    • attributes: Cogl.Attribute

      An array of pointers to #CoglAttribute<-- -->s defining vertex geometry

    • nAttributes: number

      The number of attributes in the attributes array.

    Returns void

  • drawMultitexturedRectangle(pipeline: Cogl.Pipeline, x1: number, y1: number, x2: number, y2: number, texCoords: number[], texCoordsLen: number): void
  • Draws a textured rectangle to framebuffer with the given pipeline state with the top left corner positioned at (x_1, y_1) and the bottom right corner positioned at (x_2, y_2). As a pipeline may contain multiple texture layers this interface lets you supply texture coordinates for each layer of the pipeline.

    The position is the position before the rectangle has been transformed by the model-view matrix and the projection matrix.

    This is a high level drawing api that can handle any kind of #CoglMetaTexture texture for the first layer such as #CoglTexture2DSliced textures which may internally be comprised of multiple low-level textures. This is unlike low-level drawing apis such as cogl_primitive_draw() which only support low level texture types that are directly supported by GPUs such as #CoglTexture2D.

    This api can not currently handle multiple high-level meta texture layers. The first layer may be a high level meta texture such as #CoglTexture2DSliced but all other layers much be low level textures such as #CoglTexture2D and additionally they should be textures that can be sampled using normalized coordinates (so not #CoglTextureRectangle textures).

    The top left texture coordinate for layer 0 of any pipeline will be (tex_coords[0], tex_coords[1]) and the bottom right coordinate will be (tex_coords[2], tex_coords[3]). The coordinates for layer 1 would be (tex_coords[4], tex_coords[5]) (tex_coords[6], tex_coords[7]) and so on...

    The given texture coordinates should always be normalized such that (0, 0) corresponds to the top left and (1, 1) corresponds to the bottom right. To map an entire texture across the rectangle pass in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, tex_coords[3]=1.

    Even if you have associated a #CoglTextureRectangle texture which normally implies working with non-normalized texture coordinates this api should still be passed normalized texture coordinates.

    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

    • pipeline: Cogl.Pipeline

      A #CoglPipeline state object

    • 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: [s_1, t_1, s_2, t_2] that are interpreted as two texture coordinates; one for the top left texel, and one for the bottom 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. (For one layer and one group of texture coordinates, this would be 4)

    Returns void

  • Draws the given primitive geometry to the specified destination framebuffer using the graphics processing state described by pipeline.

    This drawing api doesn't support high-level meta texture types such as #CoglTexture2DSliced so it is the user's responsibility to ensure that only low-level textures that can be directly sampled by a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are associated with layers of the given pipeline.

    This api doesn't support any of the legacy global state options such as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or cogl_program_use()

    Parameters

    • pipeline: Cogl.Pipeline

      A #CoglPipeline state object

    • primitive: Primitive

      A #CoglPrimitive geometry object

    Returns void

  • drawRectangle(pipeline: Cogl.Pipeline, x1: number, y1: number, x2: number, y2: number): void
  • Draws a rectangle to framebuffer with the given pipeline state and with the top left corner positioned at (x_1, y_1) and the bottom right corner positioned at (x_2, y_2).

    The position is the position before the rectangle has been transformed by the model-view matrix and the projection matrix.

    If you want to describe a rectangle with a texture mapped on it then you can use cogl_framebuffer_draw_textured_rectangle().

    Parameters

    • pipeline: Cogl.Pipeline

      A #CoglPipeline state object

    • 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

  • drawRectangles(pipeline: Cogl.Pipeline, coordinates: number[], nRectangles: number): void
  • Draws a series of rectangles to framebuffer with the given pipeline state in the same way that cogl_framebuffer_draw_rectangle() does.

    The top left corner of the first rectangle is positioned at (coordinates[0], coordinates[1]) and the bottom right corner is positioned at (coordinates[2], coordinates[3]). The positions for the second rectangle are (coordinates[4], coordinates[5]) and (coordinates[6], coordinates[7]) and so on...

    The position is the position before the rectangle has been transformed by the model-view matrix and the projection matrix.

    As a general rule for better performance its recommended to use this this API instead of calling cogl_framebuffer_draw_textured_rectangle() separately for multiple rectangles if all of the rectangles will be drawn together with the same pipeline state.

    Parameters

    • pipeline: Cogl.Pipeline

      A #CoglPipeline state object

    • coordinates: number[]

      an array of coordinates containing groups of 4 float values: [x_1, y_1, x_2, y_2] that are interpreted as two position coordinates; one for the top left of the rectangle (x1, y1), and one for the bottom right of the rectangle (x2, y2).

    • nRectangles: number

      number of rectangles defined in coordinates.

    Returns void

  • drawTexturedRectangle(pipeline: Cogl.Pipeline, x1: number, y1: number, x2: number, y2: number, s1: number, t1: number, s2: number, t2: number): void
  • Draws a textured rectangle to framebuffer using the given pipeline state with the top left corner positioned at (x_1, y_1) and the bottom right corner positioned at (x_2, y_2). The top left corner will have texture coordinates of (s_1, t_1) and the bottom right corner will have texture coordinates of (s_2, t_2).

    The position is the position before the rectangle has been transformed by the model-view matrix and the projection matrix.

    This is a high level drawing api that can handle any kind of #CoglMetaTexture texture such as #CoglTexture2DSliced textures which may internally be comprised of multiple low-level textures. This is unlike low-level drawing apis such as cogl_primitive_draw() which only support low level texture types that are directly supported by GPUs such as #CoglTexture2D.

    The given texture coordinates will only be used for the first texture layer of the pipeline and if your pipeline has more than one layer then all other layers will have default texture coordinates of s_1=0.0 t_1=0.0 s_2=1.0 t_2=1.0

    The given texture coordinates should always be normalized such that (0, 0) corresponds to the top left and (1, 1) corresponds to the bottom right. To map an entire texture across the rectangle pass in s_1=0, t_1=0, s_2=1, t_2=1.

    Even if you have associated a #CoglTextureRectangle texture with one of your pipeline layers which normally implies working with non-normalized texture coordinates this api should still be passed normalized texture coordinates.

    Parameters

    • pipeline: Cogl.Pipeline

      A #CoglPipeline state object

    • 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.

    • s1: number

      S texture coordinate of the top-left coorner

    • t1: number

      T texture coordinate of the top-left coorner

    • s2: number

      S texture coordinate of the bottom-right coorner

    • t2: number

      T texture coordinate of the bottom-right coorner

    Returns void

  • drawTexturedRectangles(pipeline: Cogl.Pipeline, coordinates: number[], nRectangles: number): void
  • Draws a series of rectangles to framebuffer with the given pipeline state in the same way that cogl_framebuffer_draw_textured_rectangle() does.

    The position is the position before the rectangle has been transformed by the model-view matrix and the projection matrix.

    This is a high level drawing api that can handle any kind of #CoglMetaTexture texture such as #CoglTexture2DSliced textures which may internally be comprised of multiple low-level textures. This is unlike low-level drawing apis such as cogl_primitive_draw() which only support low level texture types that are directly supported by GPUs such as #CoglTexture2D.

    The top left corner of the first rectangle is positioned at (coordinates[0], coordinates[1]) and the bottom right corner is positioned at (coordinates[2], coordinates[3]). The top left texture coordinate is (coordinates[4], coordinates[5]) and the bottom right texture coordinate is (coordinates[6], coordinates[7]). The coordinates for subsequent rectangles are defined similarly by the subsequent coordinates.

    As a general rule for better performance its recommended to use this this API instead of calling cogl_framebuffer_draw_textured_rectangle() separately for multiple rectangles if all of the rectangles will be drawn together with the same pipeline state.

    The given texture coordinates should always be normalized such that (0, 0) corresponds to the top left and (1, 1) corresponds to the bottom right. To map an entire texture across the rectangle pass in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, tex_coords[3]=1.

    Even if you have associated a #CoglTextureRectangle texture which normally implies working with non-normalized texture coordinates this api should still be passed normalized texture coordinates.

    Parameters

    • pipeline: Cogl.Pipeline

      A #CoglPipeline state object

    • coordinates: number[]

      an array containing groups of 8 float values: [x_1, y_1, x_2, y_2, s_1, t_1, s_2, t_2] that have the same meaning as the arguments for cogl_framebuffer_draw_textured_rectangle().

    • nRectangles: number

      number of rectangles to coordinates to draw

    Returns void

  • emit(sigName: string, ...args: any[]): void
  • finish(): void
  • This blocks the CPU until all pending rendering associated with the specified framebuffer has completed. It's very rare that developers should ever need this level of synchronization with the GPU and should never be used unless you clearly understand why you need to explicitly force synchronization.

    One example might be for benchmarking purposes to be sure timing measurements reflect the time that the GPU is busy for not just the time it takes to queue rendering commands.

    Returns void

  • forceFloating(): void
  • This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

    Returns void

  • freezeNotify(): void
  • Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

    This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

    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

  • getAlphaBits(): number
  • getBlueBits(): number
  • getBufferAge(): number
  • Gets the current age of the buffer contents.

    This function allows applications to query the age of the current back buffer contents for a #CoglOnscreen as the number of frames elapsed since the contents were most recently defined.

    These age values exposes enough information to applications about how Cogl internally manages back buffers to allow applications to re-use the contents of old frames and minimize how much must be redrawn for the next frame.

    The back buffer contents can either be reported as invalid (has an age of 0) or it may be reported to be the same contents as from n frames prior to the current frame.

    The queried value remains valid until the next buffer swap.

    One caveat is that under X11 the buffer age does not reflect changes to buffer contents caused by the window systems. X11 applications must track Expose events to determine what buffer regions need to additionally be repaired each frame.

    The recommended way to take advantage of this buffer age api is to build up a circular buffer of length 3 for tracking damage regions over the last 3 frames and when starting a new frame look at the age of the buffer and combine the damage regions for the current frame with the damage regions of previous age frames so you know everything that must be redrawn to update the old contents for the new frame.

    If the system doesn't not support being able to track the age of back buffers then this function will always return 0 which implies that the contents are undefined.

    The %COGL_FEATURE_ID_BUFFER_AGE feature can optionally be explicitly checked to determine if Cogl is currently tracking the age of #CoglOnscreen back buffer contents. If this feature is missing then this function will always return 0.

    Returns number

  • getData(key?: string): object
  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • Optional key: string

      name of the key for that association

    Returns object

  • getDepthBits(): number
  • Retrieves the depth buffer of framebuffer as a #CoglTexture. You need to call cogl_framebuffer_get_depth_texture(fb, TRUE); before using this function.

    Calling this function implicitely allocates the framebuffer. The texture returned stays valid as long as the framebuffer stays valid.

    Returns Cogl.Texture

  • getDepthTextureEnabled(): number
  • getDepthWriteEnabled(): number
  • getDitherEnabled(): number
  • Returns whether dithering has been requested for the given framebuffer. See cogl_framebuffer_set_dither_enabled() for more details about dithering.

    This may return %TRUE even when the underlying framebuffer display pipeline does not support dithering. This value only represents the user's request for dithering.

    Returns number

  • getFrameCounter(): number
  • Gets the value of the framebuffers frame counter. This is a counter that increases by one each time cogl_onscreen_swap_buffers() or cogl_onscreen_swap_region() is called.

    Returns number

  • getGreenBits(): number
  • getHeight(): number
  • getIsStereo(): number
  • getProperty(propertyName?: string, value?: any): void
  • Gets a property of an object.

    The value can be:

    • an empty #GValue initialized by %G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a #GValue initialized with the expected type of the property
    • a #GValue initialized with a type to which the expected type of the property can be transformed

    In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset().

    Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.

    Parameters

    • Optional propertyName: string

      the name of the property to get

    • Optional value: any

      return location for the property value

    Returns void

  • getQdata(quark: number): object
  • This function gets back user data pointers stored via g_object_set_qdata().

    Parameters

    • quark: number

      A #GQuark, naming the user data pointer

    Returns object

  • getRedBits(): number
  • getResizable(): number
  • Lets you query whether onscreen has been marked as resizable via the cogl_onscreen_set_resizable() api.

    By default, if possible, a onscreen will be created by Cogl as non resizable, but it is not guaranteed that this is always possible for all window systems.

    If cogl_onscreen_set_resizable(onscreen, %TRUE) has been previously called then this function will return %TRUE, but it's possible that the current windowing system being used does not support window resizing (consider fullscreen windows on a phone or a TV). This function is not aware of whether resizing is truly meaningful with your window system, only whether the onscreen has been marked as resizable.

    Returns number

  • getSamplesPerPixel(): number
  • Gets the number of points that are sampled per-pixel when rasterizing geometry. Usually by default this will return 0 which means that single-sample not multisample rendering has been chosen. When using a GPU supporting multisample rendering it's possible to increase the number of samples per pixel using cogl_framebuffer_set_samples_per_pixel().

    Calling cogl_framebuffer_get_samples_per_pixel() before the framebuffer has been allocated will simply return the value set using cogl_framebuffer_set_samples_per_pixel(). After the framebuffer has been allocated the value will reflect the actual number of samples that will be made by the GPU.

    Returns number

  • getViewport4fv(): number[]
  • Queries the x, y, width and height components of the current viewport as set using cogl_framebuffer_set_viewport() or the default values which are 0, 0, framebuffer_width and framebuffer_height. The values are written into the given viewport array.

    Returns number[]

  • getViewportHeight(): number
  • getViewportWidth(): number
  • Queries the width of the viewport as set using cogl_framebuffer_set_viewport() or the default value which is the width of the framebuffer.

    Returns number

  • getViewportX(): number
  • Queries the x coordinate of the viewport origin as set using cogl_framebuffer_set_viewport() or the default value which is 0.

    Returns number

  • getViewportY(): number
  • Queries the y coordinate of the viewport origin as set using cogl_framebuffer_set_viewport() or the default value which is 0.

    Returns number

  • getWidth(): number
  • getv(names: string[], values: any[]): void
  • Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

    Parameters

    • names: string[]

      the names of each property to get

    • values: any[]

      the values of each property to get

    Returns void

  • hide(): void
  • This requests to make onscreen invisible to the user.

    Actually the precise semantics of this function depend on the window system currently in use, and if you don't have a multi-windowining system this function may in-fact do nothing.

    This function does not implicitly allocate the given onscreen framebuffer before hiding it.

    Since Cogl doesn't explicitly track the visibility status of onscreen framebuffers it wont try to avoid redundant window system requests e.g. to show an already visible window. This also means that it's acceptable to alternatively use native APIs to show and hide windows without confusing Cogl.

    Returns void

  • identityMatrix(): void
  • isFloating(): boolean
  • notify(propertyName: string): void
  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    • propertyName: string

      the name of a property installed on the class of object.

    Returns void

  • Emits a "notify" signal for the property specified by pspec on object.

    This function omits the property name lookup, hence it is faster than g_object_notify().

    One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:

      enum
    {
    PROP_0,
    PROP_FOO,
    PROP_LAST
    };

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
    0, 100,
    50,
    G_PARAM_READWRITE);
    g_object_class_install_property (gobject_class,
    PROP_FOO,
    properties[PROP_FOO]);
    }

    and then notify a change on the "foo" property with:

      g_object_notify_by_pspec (self, properties[PROP_FOO]);
    

    Parameters

    • pspec: ParamSpec

      the #GParamSpec of a property installed on the class of object.

    Returns void

  • off(sigName: string, callback: ((...args: any[]) => void)): EventEmitter
  • Parameters

    • sigName: string
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns EventEmitter

  • on(sigName: string, callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • Parameters

    • sigName: string
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • once(sigName: string, callback: ((...args: any[]) => void), after?: boolean): EventEmitter
  • Parameters

    • sigName: string
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional after: boolean

    Returns EventEmitter

  • orthographic(x1: number, y1: number, x2: number, y2: number, near: number, far: number): void
  • Replaces the current projection matrix with an orthographic projection matrix.

    Parameters

    • x1: number

      The x coordinate for the first vertical clipping plane

    • y1: number

      The y coordinate for the first horizontal clipping plane

    • x2: number

      The x coordinate for the second vertical clipping plane

    • y2: number

      The y coordinate for the second horizontal clipping plane

    • near: number

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

    • far: number

      The distance to the far clipping plane (will be 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, and must not be 0)

    • zFar: number

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

    Returns void

  • popClip(): void
  • Reverts the clipping region to the state before the last call to cogl_framebuffer_push_scissor_clip(), cogl_framebuffer_push_rectangle_clip() cogl_framebuffer_push_path_clip(), or cogl_framebuffer_push_primitive_clip().

    Returns void

  • popMatrix(): void
  • pushMatrix(): void
  • Copies the current model-view matrix onto the matrix stack. The matrix can later be restored with cogl_framebuffer_pop_matrix().

    Returns void

  • pushPrimitiveClip(primitive: Primitive, boundsX1: number, boundsY1: number, boundsX2: number, boundsY2: number): void
  • Sets a new clipping area using a 2D shaped described with a #CoglPrimitive. The shape must not contain self overlapping geometry and must lie on a single 2D plane. A bounding box of the 2D shape in local coordinates (the same coordinates used to describe the shape) must be given. It is acceptable for the bounds to be larger than the true bounds but behaviour is undefined if the bounds are smaller than the true bounds.

    The primitive is transformed by the current model-view matrix and the silhouette is intersected with the previous clipping area. To restore the previous clipping area, call cogl_framebuffer_pop_clip().

    Parameters

    • primitive: Primitive

      A #CoglPrimitive describing a flat 2D shape

    • boundsX1: number

      x coordinate for the top-left corner of the primitives bounds

    • boundsY1: number

      y coordinate for the top-left corner of the primitives bounds

    • boundsX2: number

      x coordinate for the bottom-right corner of the primitives bounds.

    • boundsY2: number

      y coordinate for the bottom-right corner of the primitives bounds.

    Returns void

  • pushRectangleClip(x1: number, y1: number, x2: number, y2: number): void
  • Specifies a modelview transformed 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_framebuffer_pop_clip().

    Parameters

    • x1: number

      x coordinate for top left corner of the clip rectangle

    • y1: number

      y coordinate for top left corner of the clip rectangle

    • x2: number

      x coordinate for bottom right corner of the clip rectangle

    • y2: number

      y coordinate for bottom right corner of the clip rectangle

    Returns void

  • pushScissorClip(x: number, y: 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_framebuffer_pop_clip().

    Parameters

    • x: number

      left edge of the clip rectangle in window coordinates

    • y: 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

  • readPixels(x: number, y: number, width: number, height: number, format: Cogl.PixelFormat, pixels: number): number
  • This is a convenience wrapper around cogl_framebuffer_read_pixels_into_bitmap() which allocates a temporary #CoglBitmap to read pixel data directly into the given buffer. The rowstride of the buffer is assumed to be the width of the region times the bytes per pixel of the format. The source for the data is always taken from the color buffer. If you want to use any other rowstride or source, please use the cogl_framebuffer_read_pixels_into_bitmap() function directly.

    The implementation of the function looks like this:

    |[ bitmap = cogl_bitmap_new_for_data (context, width, height, format, /* rowstride */ bpp * width, pixels); cogl_framebuffer_read_pixels_into_bitmap (framebuffer, x, y, COGL_READ_PIXELS_COLOR_BUFFER, bitmap); cogl_object_unref (bitmap);


    @param x The x position to read from
    @param y The y position to read from
    @param width The width of the region of rectangles to read
    @param height The height of the region of rectangles to read
    @param format The pixel format to store the data in
    @param pixels The address of the buffer to store the data in

    Parameters

    • x: number
    • y: number
    • width: number
    • height: number
    • format: Cogl.PixelFormat
    • pixels: number

    Returns number

  • This reads a rectangle of pixels from the given framebuffer where position (0, 0) is the top left. The pixel at (x, y) is the first read, and a rectangle of pixels with the same size as the bitmap is read right and downwards from that point.

    Currently Cogl assumes that the framebuffer is in a premultiplied format so if the format of bitmap 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 x position to read from

    • y: number

      The y position to read from

    • source: Cogl.ReadPixelsFlags

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

    • bitmap: Cogl.Bitmap

      The bitmap to store the results in.

    Returns number

  • Increases the reference count of object.

    Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type of object will be propagated to the return type (using the GCC typeof() extension), so any casting the caller needs to do on the return type must be explicit.

    Returns GObject.Object

  • Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

    In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.

    Since GLib 2.56, the type of object will be propagated to the return type under the same conditions as for g_object_ref().

    Returns GObject.Object

  • Removes a callback and associated user data that were previously registered using cogl_onscreen_add_dirty_callback().

    If a destroy callback was passed to cogl_onscreen_add_dirty_callback() to destroy the user data then this will also get called.

    Parameters

    • closure: OnscreenDirtyClosure

      A #CoglOnscreenDirtyClosure returned from cogl_onscreen_add_dirty_callback()

    Returns void

  • Removes a callback and associated user data that were previously registered using cogl_onscreen_add_frame_callback().

    If a destroy callback was passed to cogl_onscreen_add_frame_callback() to destroy the user data then this will get called.

    Parameters

    • closure: FrameClosure

      A #CoglFrameClosure returned from cogl_onscreen_add_frame_callback()

    Returns void

  • Removes a resize callback and user_data pair that were previously associated with onscreen via cogl_onscreen_add_resize_callback().

    Parameters

    Returns void

  • removeSwapBuffersCallback(id: number): void
  • Removes a callback that was previously registered using cogl_onscreen_add_swap_buffers_callback().

    Parameters

    • id: number

      An identifier returned from cogl_onscreen_add_swap_buffers_callback()

    Returns void

  • resolveSamples(): void
  • When point sample rendering (also known as multisample rendering) has been enabled via cogl_framebuffer_set_samples_per_pixel() then you can optionally call this function (or cogl_framebuffer_resolve_samples_region()) to explicitly resolve the point samples into values for the final color buffer.

    Some GPUs will implicitly resolve the point samples during rendering and so this function is effectively a nop, but with other architectures it is desirable to defer the resolve step until the end of the frame.

    Since Cogl will automatically ensure samples are resolved if the target color buffer is used as a source this API only needs to be used if explicit control is desired - perhaps because you want to ensure that the resolve is completed in advance to avoid later having to wait for the resolve to complete.

    If you are performing incremental updates to a framebuffer you should consider using cogl_framebuffer_resolve_samples_region() instead to avoid resolving redundant pixels.

    Returns void

  • resolveSamplesRegion(x: number, y: number, width: number, height: number): void
  • When point sample rendering (also known as multisample rendering) has been enabled via cogl_framebuffer_set_samples_per_pixel() then you can optionally call this function (or cogl_framebuffer_resolve_samples()) to explicitly resolve the point samples into values for the final color buffer.

    Some GPUs will implicitly resolve the point samples during rendering and so this function is effectively a nop, but with other architectures it is desirable to defer the resolve step until the end of the frame.

    Use of this API is recommended if incremental, small updates to a framebuffer are being made because by default Cogl will implicitly resolve all the point samples of the framebuffer which can result in redundant work if only a small number of samples have changed.

    Because some GPUs implicitly resolve point samples this function only guarantees that at-least the region specified will be resolved and if you have rendered to a larger region then it's possible that other samples may be implicitly resolved.

    Parameters

    • x: number

      top-left x coordinate of region to resolve

    • y: number

      top-left y coordinate of region to resolve

    • width: number

      width of region to resolve

    • height: number

      height of region to resolve

    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 axis-vector specified by x, y and z. The rotation follows the right-hand thumb rule so for example rotating by 10 degrees about the axis-vector (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

  • runDispose(): void
  • Releases all references to other objects. This can be used to break reference cycles.

    This function should only be called from object system implementations.

    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

  • Defines a bit mask of which color channels should be written to the given framebuffer. If a bit is set in color_mask that means that color will be written.

    Parameters

    • colorMask: Cogl.ColorMask

      A #CoglColorMask of which color channels to write to the current framebuffer.

    Returns void

  • setData(key: string, data?: object): void
  • Each object carries around a table of associations from strings to pointers. This function lets you set an association.

    If the object already had an association with that name, the old association will be destroyed.

    Internally, the key is converted to a #GQuark using g_quark_from_string(). This means a copy of key is kept permanently (even after object has been finalized) — so it is recommended to only use a small, bounded set of values for key in your program, to avoid the #GQuark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • Optional data: object

      data to associate with that key

    Returns void

  • setDepthTextureEnabled(enabled: number): void
  • If enabled is #TRUE, the depth buffer used when rendering to framebuffer is available as a texture. You can retrieve the texture with cogl_framebuffer_get_depth_texture().

    It's possible that your GPU does not support depth textures. You should check the %COGL_FEATURE_ID_DEPTH_TEXTURE feature before using this function. It's not valid to call this function after the framebuffer has been allocated as the creation of the depth texture is done at allocation time.

    Parameters

    • enabled: number

      TRUE or FALSE

    Returns void

  • setDepthWriteEnabled(depthWriteEnabled: number): void
  • Enables or disables depth buffer writing when rendering to framebuffer. If depth writing is enabled for both the framebuffer and the rendering pipeline, and the framebuffer has an associated depth buffer, depth information will be written to this buffer during rendering.

    Depth buffer writing is enabled by default.

    Parameters

    • depthWriteEnabled: number

      %TRUE to enable depth writing or %FALSE to disable

    Returns void

  • setDitherEnabled(ditherEnabled: number): void
  • Enables or disabled dithering if supported by the hardware.

    Dithering is a hardware dependent technique to increase the visible color resolution beyond what the underlying hardware supports by playing tricks with the colors placed into the framebuffer to give the illusion of other colors. (For example this can be compared to half-toning used by some news papers to show varying levels of grey even though their may only be black and white are available).

    If the current display pipeline for framebuffer does not support dithering then this has no affect.

    Dithering is enabled by default.

    Parameters

    • ditherEnabled: number

      %TRUE to enable dithering or %FALSE to disable

    Returns void

  • setProperty(propertyName: string, value?: any): void
  • Sets a property on an object.

    Parameters

    • propertyName: string

      the name of the property to set

    • Optional value: any

      the value

    Returns void

  • setResizable(resizable: number): void
  • Lets you request Cogl to mark an onscreen framebuffer as resizable or not.

    By default, if possible, a onscreen will be created by Cogl as non resizable, but it is not guaranteed that this is always possible for all window systems.

    Cogl does not know whether marking the onscreen framebuffer is truly meaningful for your current window system (consider applications being run fullscreen on a phone or TV) so this function may not have any useful effect. If you are running on a multi windowing system such as X11 or Win32 or OSX then Cogl will request to the window system that users be allowed to resize the onscreen, although it's still possible that some other window management policy will block this possibility.

    Whenever an onscreen framebuffer is resized the viewport will be automatically updated to match the new size of the framebuffer with an origin of (0,0). If your application needs more specialized control of the viewport it will need to register a resize handler using cogl_onscreen_add_resize_callback() so that it can track when the viewport has been changed automatically.

    Parameters

    • resizable: number

    Returns void

  • setSamplesPerPixel(samplesPerPixel: number): void
  • Requires that when rendering to framebuffer then n point samples should be made per pixel which will all contribute to the final resolved color for that pixel. The idea is that the hardware aims to get quality similar to what you would get if you rendered everything twice as big (for 4 samples per pixel) and then scaled that image back down with filtering. It can effectively remove the jagged edges of polygons and should be more efficient than if you were to manually render at a higher resolution and downscale because the hardware is often able to take some shortcuts. For example the GPU may only calculate a single texture sample for all points of a single pixel, and for tile based architectures all the extra sample data (such as depth and stencil samples) may be handled on-chip and so avoid increased demand on system memory bandwidth.

    By default this value is usually set to 0 and that is referred to as "single-sample" rendering. A value of 1 or greater is referred to as "multisample" rendering.

    There are some semantic differences between single-sample rendering and multisampling with just 1 point sample such as it being redundant to use the cogl_framebuffer_resolve_samples() and cogl_framebuffer_resolve_samples_region() apis with single-sample rendering.

    It's recommended that cogl_framebuffer_resolve_samples_region() be explicitly used at the end of rendering to a point sample buffer to minimize the number of samples that get resolved. By default Cogl will implicitly resolve all framebuffer samples but if only a small region of a framebuffer has changed this can lead to redundant work being done.

    Parameters

    • samplesPerPixel: number

      The minimum number of samples per pixel

    Returns void

  • Sets which stereo buffers should be drawn to. The default is %COGL_STEREO_BOTH, which means that both the left and right buffers will be affected by drawing. For this to have an effect, the display system must support stereo drawables, and the framebuffer must have been created with stereo enabled. (See cogl_onscreen_template_set_stereo_enabled(), cogl_framebuffer_get_is_stereo().)

    Parameters

    • stereoMode: Cogl.StereoMode

      A #CoglStereoMode specifying which stereo buffers should be drawn tow.

    Returns void

  • setSwapThrottled(throttled: number): void
  • Requests that the given onscreen framebuffer should have swap buffer requests (made using cogl_onscreen_swap_buffers()) throttled either by a displays vblank period or perhaps some other mechanism in a composited environment.

    Parameters

    • throttled: number

      Whether swap throttling is wanted or not.

    Returns void

  • setViewport(x: number, y: number, width: number, height: number): void
  • Defines a scale and offset for everything rendered relative to the top-left of the destination framebuffer.

    By default the viewport has an origin of (0,0) and width and height that match the framebuffer's size. Assuming a default projection and modelview matrix then you could translate the contents of a window down and right by leaving the viewport size unchanged by moving the offset to (10,10). The viewport coordinates are measured in pixels. If you left the x and y origin as (0,0) you could scale the windows contents down by specify and width and height that's half the real size of the framebuffer.

    Although the function takes floating point arguments, existing drivers only allow the use of integer values. In the future floating point values will be exposed via a checkable feature.

    Parameters

    • x: number

      The top-left x coordinate of the viewport origin (only integers supported currently)

    • y: number

      The top-left y coordinate of the viewport origin (only integers supported currently)

    • width: number

      The width of the viewport (only integers supported currently)

    • height: number

      The height of the viewport (only integers supported currently)

    Returns void

  • show(): void
  • This requests to make onscreen visible to the user.

    Actually the precise semantics of this function depend on the window system currently in use, and if you don't have a multi-windowining system this function may in-fact do nothing.

    This function will implicitly allocate the given onscreen framebuffer before showing it if it hasn't already been allocated.

    When using the Wayland winsys calling this will set the surface to a toplevel type which will make it appear. If the application wants to set a different type for the surface, it can avoid calling cogl_onscreen_show() and set its own type directly with the Wayland client API via cogl_wayland_onscreen_get_surface().

    Since Cogl doesn't explicitly track the visibility status of onscreen framebuffers it wont try to avoid redundant window system requests e.g. to show an already visible window. This also means that it's acceptable to alternatively use native APIs to show and hide windows without confusing Cogl.

    Returns void

  • stealData(key?: string): object
  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • Optional key: string

      name of the key

    Returns object

  • stealQdata(quark: number): object
  • This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

    void
    object_add_to_user_list (GObject *object,
    const gchar *new_string)
    {
    // the quark, naming the object data
    GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
    // retrieve the old string list
    GList *list = g_object_steal_qdata (object, quark_string_list);

    // prepend new string
    list = g_list_prepend (list, g_strdup (new_string));
    // this changed 'list', so we need to set it again
    g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
    }
    static void
    free_string_list (gpointer data)
    {
    GList *node, *list = data;

    for (node = list; node; node = node->next)
    g_free (node->data);
    g_list_free (list);
    }

    Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().

    Parameters

    • quark: number

      A #GQuark, naming the user data pointer

    Returns object

  • swapBuffers(): void
  • Swaps the current back buffer being rendered too, to the front for display.

    This function also implicitly discards the contents of the color, depth and stencil buffers as if cogl_framebuffer_discard_buffers() were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame.

    It is highly recommended that applications use cogl_onscreen_swap_buffers_with_damage() instead whenever possible and also use the cogl_onscreen_get_buffer_age() api so they can perform incremental updates to older buffers instead of having to render a full buffer for every frame.

    Returns void

  • swapBuffersWithDamage(rectangles: number, nRectangles: number): void
  • Swaps the current back buffer being rendered too, to the front for display and provides information to any system compositor about what regions of the buffer have changed (damage) with respect to the last swapped buffer.

    This function has the same semantics as cogl_framebuffer_swap_buffers() except that it additionally allows applications to pass a list of damaged rectangles which may be passed on to a compositor so that it can minimize how much of the screen is redrawn in response to this applications newly swapped front buffer.

    For example if your application is only animating a small object in the corner of the screen and everything else is remaining static then it can help the compositor to know that only the bottom right corner of your newly swapped buffer has really changed with respect to your previously swapped front buffer.

    If n_rectangles is 0 then the whole buffer will implicitly be reported as damaged as if cogl_onscreen_swap_buffers() had been called.

    This function also implicitly discards the contents of the color, depth and stencil buffers as if cogl_framebuffer_discard_buffers() were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame. If you want to perform incremental updates to older back buffers then please refer to the cogl_onscreen_get_buffer_age() api.

    Whenever possible it is recommended that applications use this function instead of cogl_onscreen_swap_buffers() to improve performance when running under a compositor.

    It is highly recommended to use this API in conjunction with the cogl_onscreen_get_buffer_age() api so that your application can perform incremental rendering based on old back buffers.

    Parameters

    • rectangles: number

      An array of integer 4-tuples representing damaged rectangles as (x, y, width, height) tuples.

    • nRectangles: number

      The number of 4-tuples to be read from rectangles

    Returns void

  • swapRegion(rectangles: number, nRectangles: number): void
  • Swaps a region of the back buffer being rendered too, to the front for display. rectangles represents the region as array of n_rectangles each defined by 4 sequential (x, y, width, height) integers.

    This function also implicitly discards the contents of the color, depth and stencil buffers as if cogl_framebuffer_discard_buffers() were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame.

    Parameters

    • rectangles: number

      An array of integer 4-tuples representing rectangles as (x, y, width, height) tuples.

    • nRectangles: number

      The number of 4-tuples to be read from rectangles

    Returns void

  • thawNotify(): void
  • Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

    Duplicate notifications for each property are squashed so that at most one #GObject::notify signal is emitted for each property, in the reverse order in which they have been queued.

    It is an error to call this function when the freeze count is zero.

    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

  • unref(): void
  • Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

    If the pointer to the #GObject may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to %NULL rather than retain a dangling pointer to a potentially invalid #GObject instance. Use g_clear_object() for this.

    Returns void

  • watchClosure(closure: TClosure<any, any>): void
  • This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

    Parameters

    • closure: TClosure<any, any>

      #GClosure to watch

    Returns void

  • compatControl(what: number, data: object): number
  • Find the #GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • gIface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    • propertyName: string

      name of a property to look up.

    Returns ParamSpec

  • Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created #GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.

    This function is meant to be called from the interface's default vtable initialization function (the class_init member of #GTypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface.

    If pspec is a floating reference, it will be consumed.

    Parameters

    • gIface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface.

    • pspec: ParamSpec

      the #GParamSpec for the new property

    Returns void

  • Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • gIface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    Returns ParamSpec[]

  • Instantiates an "unallocated" #CoglOnscreen framebuffer that may be configured before later being allocated, either implicitly when it is first used or explicitly via cogl_framebuffer_allocate().

    Parameters

    • context: Cogl.Context

      A #CoglContext

    • width: number

      The desired framebuffer width

    • height: number

      The desired framebuffer height

    Returns Onscreen

  • Creates a new instance of a #GObject subtype and sets its properties.

    Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.

    Parameters

    • objectType: GType<unknown>

      the type id of the #GObject subtype to instantiate

    • parameters: GObject.Parameter[]

      an array of #GParameter

    Returns GObject.Object

  • valueGetObject(value: any): object
  • valueSetObject(value: any, object: object): 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