gi-cogl-1.0.2: COGL GObject bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Cogl.Functions

Contents

Description

 
Synopsis

Methods

beginGl

beginGl :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.16)Use the CoglGLES2Context api instead

We do not advise nor reliably support the interleaving of raw GL drawing and Cogl drawing functions, but if you insist, beginGl and endGl 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 beginGl and endGl:

{
   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 beginGl. E.g. by calling setSourceColor4ub.</note>

<note>It is your responsibility to restore any OpenGL state that you modify to how it was after calling beginGl 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.

Since: 1.0

checkExtension

checkExtension Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

name: extension to check for

-> Text

ext: list of extensions

-> m Int32

Returns: True if the extension occurs in the list, False otherwise.

Deprecated: (Since version 1.2)OpenGL is an implementation detail for Cogl and so it's not appropriate to expose OpenGL extensions through the Cogl API. This function can be replaced by the following equivalent code:|[ CoglBool retval = (strstr (ext, name) != NULL) ? TRUE : FALSE;]|

Check whether name occurs in list of extensions in ext.

clear'

clear' Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: Background color to clear to

-> CULong

buffers: A mask of BufferBit's identifying which auxiliary buffers to clear

-> m () 

Deprecated: (Since version 1.16)Use cogl_framebuffer_clear() api instead

Clears all the auxiliary buffers identified in the buffers mask, and if that includes the color buffer then the specified color is used.

clipEnsure

clipEnsure :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.2)Calling this function has no effect

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.

Since: 1.0

clipPop

clipPop :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.16)Use cogl_framebuffer_pop_clip() instead

Reverts the clipping region to the state before the last call to clipPush.

clipPush

clipPush Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

xOffset: left edge of the clip rectangle

-> Float

yOffset: top edge of the clip rectangle

-> Float

width: width of the clip rectangle

-> Float

height: height of the clip rectangle

-> m () 

Deprecated: (Since version 1.16)The x, y, width, height arguments are inconsistent with other API that specify rectangles in model space, and when used with a coordinate space that puts the origin at the center and y+ extending up, it's awkward to use. Please use cogl_framebuffer_push_rectangle_clip()

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

clipPushRectangle

clipPushRectangle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

x0: x coordinate for top left corner of the clip rectangle

-> Float

y0: y coordinate for top left corner of the clip rectangle

-> Float

x1: x coordinate for bottom right corner of the clip rectangle

-> Float

y1: y coordinate for bottom right corner of the clip rectangle

-> m () 

Deprecated: (Since version 1.16)Use cogl_framebuffer_push_rectangle_clip() instead

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

Since: 1.2

clipPushWindowRect

clipPushWindowRect Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

xOffset: left edge of the clip rectangle in window coordinates

-> Float

yOffset: top edge of the clip rectangle in window coordinates

-> Float

width: width of the clip rectangle

-> Float

height: height of the clip rectangle

-> m () 

Deprecated: (Since version 1.16)Use cogl_framebuffer_push_scissor_clip() instead

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

clipPushWindowRectangle

clipPushWindowRectangle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

xOffset: left edge of the clip rectangle in window coordinates

-> Int32

yOffset: top edge of the clip rectangle in window coordinates

-> Int32

width: width of the clip rectangle

-> Int32

height: height of the clip rectangle

-> m () 

Deprecated: (Since version 1.16)Use cogl_framebuffer_push_scissor_clip() instead

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

Since: 1.2

clipStackRestore

clipStackRestore :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.2)This was originally added to allow us to restore the clip stack when switching back from an offscreen framebuffer, but it's not necessary anymore given that framebuffers now own separate clip stacks which will be automatically switched between when a new buffer is set. Calling this function has no effect

Restore the state of the clipping stack that was previously saved by clipStackSave.

Since: 0.8.2

clipStackSave

clipStackSave :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.2)This was originally added to allow us to save the clip stack when switching to an offscreen framebuffer, but it's not necessary anymore given that framebuffers now own separate clip stacks which will be automatically switched between when a new buffer is set. Calling this function has no effect

Save the entire state of the clipping stack and then clear all clipping. The previous state can be returned to with clipStackRestore. Each call to clipPush after this must be matched by a call to clipPop before calling clipStackRestore.

Since: 0.8.2

clutterCheckExtensionCLUTTER

clutterCheckExtensionCLUTTER :: (HasCallStack, MonadIO m) => Text -> Text -> m Int32 Source #

No description available in the introspection data.

clutterWinsysHasFeatureCLUTTER

clutterWinsysHasFeatureCLUTTER :: (HasCallStack, MonadIO m) => WinsysFeature -> m Int32 Source #

No description available in the introspection data.

createProgram

createProgram Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m (Ptr ())

Returns: a new cogl program.

Deprecated: (Since version 1.16)Use CoglSnippet api

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

createShader

createShader Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ShaderType

shaderType: COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT.

-> m (Ptr ())

Returns: a new shader handle.

Deprecated: (Since version 1.16)Use CoglSnippet api

Create a new shader handle, use shaderSource to set the source code to be used on it.

debugMatrixPrint

debugMatrixPrint Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: A Matrix

-> m () 

Prints the contents of a Matrix to stdout.

Since: 2.0

disableFog

disableFog :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.16)Use CoglSnippet shader api for fog

This function disables fogging, so primitives drawn afterwards will not be blended with any previously set fog color.

doubleToInt

doubleToInt :: (HasCallStack, MonadIO m) => Double -> m Int32 Source #

No description available in the introspection data.

doubleToUint

doubleToUint :: (HasCallStack, MonadIO m) => Double -> m Word32 Source #

No description available in the introspection data.

endGl

endGl :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.16)Use the CoglGLES2Context api instead

This is the counterpart to beginGl used to delimit blocks of drawing code using raw OpenGL. Please refer to beginGl for full details.

Since: 1.0

featuresAvailable

featuresAvailable Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [FeatureFlags]

features: A bitmask of features to check for

-> m Int32

Returns: True if the features are available, False otherwise.

Deprecated: (Since version 1.10)Use cogl_has_feature() instead

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.

flush

flush :: (HasCallStack, MonadIO m) => m () Source #

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.

Since: 1.0

frustum

frustum Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

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

-> Float

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

-> Float

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

-> Float

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

-> Float

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

-> Float

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

-> m () 

Deprecated: (Since version 1.10)Use cogl_framebuffer_frustum() instead

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.

Since: 0.8.2

getBackfaceCullingEnabled

getBackfaceCullingEnabled Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Int32

Returns: True if backface culling is enabled, and False otherwise

Deprecated: (Since version 1.16)Use cogl_pipeline_get_cull_face_mode() instead

Queries if backface culling has been enabled via setBackfaceCullingEnabled

getBitmasks

getBitmasks :: (HasCallStack, MonadIO m) => m (Int32, Int32, Int32, Int32) Source #

Deprecated: (Since version 1.8)Use cogl_framebuffer_get_red/green/blue/alpha_bits() instead

Gets the number of bitplanes used for each of the color components in the color buffer. Pass Nothing for any of the arguments if the value is not required.

getDepthTestEnabled

getDepthTestEnabled Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Int32

Returns: True if depth testing is enabled, and False otherwise

Deprecated: (Since version 1.16)Use cogl_pipeline_set_depth_state() instead

Queries if depth testing has been enabled via cogl_set_depth_test_enable()

getFeatures

getFeatures Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m [FeatureFlags]

Returns: A logical OR of all the supported COGL features.

Deprecated: (Since version 1.10)Use cogl_foreach_feature() instead

Returns all of the features supported by COGL.

Since: 0.8

getModelviewMatrix

getModelviewMatrix :: (HasCallStack, MonadIO m) => m Matrix Source #

Deprecated: (Since version 1.10)Use cogl_framebuffer_get_modelview_matrix() instead

Stores the current model-view matrix in matrix.

getOptionGroup

getOptionGroup Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m OptionGroup

Returns: a OptionGroup

Deprecated: (Since version 1.16)Not replaced

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

Since: 1.0

getProjectionMatrix

getProjectionMatrix :: (HasCallStack, MonadIO m) => m Matrix Source #

Deprecated: (Since version 1.10)Use cogl_framebuffer_get_projection_matrix() instead

Stores the current projection matrix in matrix.

getSource

getSource Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m (Ptr ())

Returns: The current source material.

Deprecated: (Since version 1.16)Latest drawing apis all take an explicit CoglPipeline argument so this stack of Materials shouldn't be used.

Returns the current source material as previously set using setSource.

<note>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.</note>

Since: 1.6

getViewport

getViewport :: (HasCallStack, MonadIO m) => m [Float] Source #

Deprecated: (Since version 1.10)Use cogl_framebuffer_get_viewport4fv() instead

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.

gtypeMatrixGetType

gtypeMatrixGetType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m GType

Returns: the GType for the registered "CoglMatrix" boxed type. This can be used for example to define GObject properties that accept a Matrix value.

Deprecated: (Since version 1.18)Use cogl_matrix_get_gtype() instead.

No description available in the introspection data.

handleGetType

handleGetType :: (HasCallStack, MonadIO m) => m GType Source #

No description available in the introspection data.

handleRef

handleRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: a CoglHandle

-> m (Ptr ())

Returns: the handle, with its reference count increased

Increases the reference count of handle by 1

handleUnref

handleUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: a CoglHandle

-> m () 

Drecreases the reference count of handle by 1; if the reference count reaches 0, the resources allocated by handle will be freed

isBitmap

isBitmap Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

object: a CoglObject pointer

-> m Int32

Returns: True if the passed object represents a bitmap, and False otherwise

Checks whether object is a Bitmap

Since: 1.0

isMaterial

isMaterial Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A CoglHandle

-> m Int32

Returns: True if the handle references a Material, False otherwise

Deprecated: (Since version 1.16)Use cogl_is_pipeline() instead

Gets whether the given handle references an existing material object.

isOffscreen

isOffscreen Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

object: A pointer to a CoglObject

-> m Int32

Returns: True if object is a Offscreen framebuffer, False otherwise

Determines whether the given CoglObject references an offscreen framebuffer object.

isProgram

isProgram Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A CoglHandle

-> m Int32

Returns: True if the handle references a program, False otherwise

Deprecated: (Since version 1.16)Use CoglSnippet api

Gets whether the given handle references an existing program object.

isShader

isShader Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A CoglHandle

-> m Int32

Returns: True if the handle references a shader, False otherwise

Deprecated: (Since version 1.16)Use CoglSnippet api

Gets whether the given handle references an existing shader object.

isTexture

isTexture Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

object: A CoglObject pointer

-> m Int32

Returns: True if the object references a texture, and False otherwise

Gets whether the given object references a texture object.

isVertexBuffer

isVertexBuffer Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: a CoglHandle for a vertex buffer object

-> m Int32

Returns: True if the handle is a VBO, and False otherwise

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

Checks whether handle is a Vertex Buffer Object

Since: 1.0

isVertexBufferIndices

isVertexBufferIndices Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: a CoglHandle

-> m Int32

Returns: True if the handle is indices, and False otherwise

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

Checks whether handle is a handle to the indices for a vertex buffer object

Since: 1.4

onscreenClutterBackendSetSizeCLUTTER

onscreenClutterBackendSetSizeCLUTTER :: (HasCallStack, MonadIO m) => Int32 -> Int32 -> m () Source #

No description available in the introspection data.

ortho

ortho Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

left: The coordinate for the left clipping plane

-> Float

right: The coordinate for the right clipping plane

-> Float

bottom: The coordinate for the bottom clipping plane

-> Float

top: The coordinate for the top clipping plane

-> Float

near: The <emphasis>distance</emphasis> to the near clipping plane (negative if the plane is behind the viewer)

-> Float

far: The <emphasis>distance</emphasis> for the far clipping plane (negative if the plane is behind the viewer)

-> m () 

Deprecated: (Since version 1.10)Use cogl_framebuffer_orthographic() instead

Replaces the current projection matrix with an orthographic projection matrix. See <xref linkend="cogl-ortho-matrix"/> to see how the matrix is calculated.

<figure id="cogl-ortho-matrix"> <title></title> <graphic fileref="cogl_ortho.png" format="PNG"/> </figure>

<note>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.</note>

Since: 1.0

perspective

perspective Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

fovy: Vertical field of view angle in degrees.

-> Float

aspect: The (width over height) aspect ratio for display

-> Float

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

-> Float

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

-> m () 

Deprecated: (Since version 1.10)Use cogl_framebuffer_perspective() instead

Replaces the current projection matrix with a perspective matrix based on the provided values.

<note>You should be careful not to have to great a zFar / zNear 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.</note>

polygon

polygon Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> TextureVertex

vertices: An array of TextureVertex structs

-> Word32

nVertices: The length of the vertices array

-> Int32

useColor: True if the color member of TextureVertex should be used

-> m () 

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

If useColor is True then the color will be changed for each vertex using the value specified in the color member of TextureVertex. 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.

Since: 1.0

popDrawBuffer

popDrawBuffer :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.16)The latest drawing apis take explicit CoglFramebuffer arguments so this stack of framebuffers shouldn't be used anymore.

Restore setDrawBuffer state.

popFramebuffer

popFramebuffer :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.16)The latest drawing apis take explicit CoglFramebuffer arguments so this stack of framebuffers shouldn't be used anymore.

Restores the framebuffer that was previously at the top of the stack. All subsequent drawing will be redirected to this framebuffer.

Since: 1.2

popMatrix

popMatrix :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.10)Use cogl_framebuffer_pop_matrix() instead

Restores the current model-view matrix from the matrix stack.

popSource

popSource :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.16)Latest drawing apis all take an explicit CoglPipeline argument so this stack of Materials shouldn't be used.

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

Since: 1.6

programAttachShader

programAttachShader Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

programHandle: a CoglHandle for a shdaer program.

-> Ptr ()

shaderHandle: a CoglHandle for a vertex of fragment shader.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

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.

programGetUniformLocation

programGetUniformLocation Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: a CoglHandle for a shader program.

-> Text

uniformName: the name of a uniform.

-> m Int32

Returns: the offset of a uniform in a specified program. This uniform can be set using programUniform1f when the program is in use.

Deprecated: (Since version 1.16)Use CoglSnippet api instead

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.

programLink

programLink Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: a CoglHandle for a shader program.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

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.

programRef

programRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A CoglHandle to a program.

-> m (Ptr ())

Returns: handle

Deprecated: (Since version 1.16)Use CoglSnippet api

Add an extra reference to a program.

programSetUniform1f

programSetUniform1f Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

program: A CoglHandle for a linked program

-> Int32

uniformLocation: the uniform location retrieved from programGetUniformLocation.

-> Float

value: the new value of the uniform.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api instead

Changes the value of a floating point uniform for the given linked program.

Since: 1.4

programSetUniform1i

programSetUniform1i Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

program: A CoglHandle for a linked program

-> Int32

uniformLocation: the uniform location retrieved from programGetUniformLocation.

-> Int32

value: the new value of the uniform.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api instead

Changes the value of an integer uniform for the given linked program.

Since: 1.4

programSetUniformFloat

programSetUniformFloat Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

program: A CoglHandle for a linked program

-> Int32

uniformLocation: the uniform location retrieved from programGetUniformLocation.

-> Int32

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

-> [Float]

value: the new value of the uniform[s].

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api instead

Changes the value of a float vector uniform, or uniform array for the given linked program.

Since: 1.4

programSetUniformInt

programSetUniformInt Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

program: A CoglHandle for a linked program

-> Int32

uniformLocation: the uniform location retrieved from programGetUniformLocation.

-> Int32

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

-> [Int32]

value: the new value of the uniform[s].

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api instead

Changes the value of a int vector uniform, or uniform array for the given linked program.

Since: 1.4

programSetUniformMatrix

programSetUniformMatrix Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

program: A CoglHandle for a linked program

-> Int32

uniformLocation: the uniform location retrieved from programGetUniformLocation.

-> Int32

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

-> Int32

transpose: Whether to transpose the matrix when setting the uniform.

-> [Float]

value: the new value of the uniform.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api instead

Changes the value of a matrix uniform, or uniform array in the given linked program.

Since: 1.4

programUniform1f

programUniform1f Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

uniformNo: the uniform to set.

-> Float

value: the new value of the uniform.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

Changes the value of a floating point uniform in the currently used (see programUse) shader program.

programUniform1i

programUniform1i Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

uniformNo: the uniform to set.

-> Int32

value: the new value of the uniform.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

Changes the value of an integer uniform in the currently used (see programUse) shader program.

programUniformFloat

programUniformFloat Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

uniformNo: the uniform to set.

-> Int32

size: Size of float vector.

-> [Float]

value: the new value of the uniform.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

Changes the value of a float vector uniform, or uniform array in the currently used (see programUse) shader program.

programUniformInt

programUniformInt Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

uniformNo: the uniform to set.

-> Int32

size: Size of int vector.

-> [Int32]

value: the new value of the uniform.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

Changes the value of a int vector uniform, or uniform array in the currently used (see programUse) shader program.

programUniformMatrix

programUniformMatrix Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

uniformNo: the uniform to set.

-> Int32

size: Size of matrix.

-> Int32

transpose: Whether to transpose the matrix when setting the uniform.

-> [Float]

value: the new value of the uniform.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

Changes the value of a matrix uniform, or uniform array in the currently used (see programUse) shader program. The size parameter is used to determine the square size of the matrix.

programUnref

programUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A CoglHandle to a program.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

Removes a reference to a program. If it was the last reference the program object will be destroyed.

programUse

programUse Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: a CoglHandle for a shader program or COGL_INVALID_HANDLE.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

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

pushDrawBuffer

pushDrawBuffer :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.16)The latest drawing apis take explicit CoglFramebuffer arguments so this stack of framebuffers shouldn't be used anymore.

Save setDrawBuffer state.

pushMatrix

pushMatrix :: (HasCallStack, MonadIO m) => m () Source #

Deprecated: (Since version 1.10)Use cogl_framebuffer_push_matrix() instead

Stores the current model-view matrix on the matrix stack. The matrix can later be restored with popMatrix.

pushSource

pushSource Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

material: A Material

-> m () 

Deprecated: (Since version 1.16)Latest drawing apis all take an explicit CoglPipeline argument so this stack of Materials shouldn't be used.

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

Since: 1.6

readPixels

readPixels Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

x: The window x position to start reading from

-> Int32

y: The window y position to start reading from

-> Int32

width: The width of the rectangle you want to read

-> Int32

height: The height of the rectangle you want to read

-> [ReadPixelsFlags]

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

-> PixelFormat

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

-> Word8

pixels: The location to write the pixel data.

-> m () 

Deprecated: (Since version 1.16)Use cogl_framebuffer_read_pixels() instead

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.

rectangle

rectangle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

x1: X coordinate of the top-left corner

-> Float

y1: Y coordinate of the top-left corner

-> Float

x2: X coordinate of the bottom-right corner

-> Float

y2: Y coordinate of the bottom-right corner

-> m () 

Fills a rectangle at the given coordinates with the current source material

rectangleWithMultitextureCoords

rectangleWithMultitextureCoords Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

x1: x coordinate upper left on screen.

-> Float

y1: y coordinate upper left on screen.

-> Float

x2: x coordinate lower right on screen.

-> Float

y2: y coordinate lower right on screen.

-> [Float]

texCoords: 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.

-> Int32

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

-> m () 

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.

Since: 1.0

rectangleWithTextureCoords

rectangleWithTextureCoords Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

x1: x coordinate upper left on screen.

-> Float

y1: y coordinate upper left on screen.

-> Float

x2: x coordinate lower right on screen.

-> Float

y2: y coordinate lower right on screen.

-> Float

tx1: x part of texture coordinate to use for upper left pixel

-> Float

ty1: y part of texture coordinate to use for upper left pixel

-> Float

tx2: x part of texture coordinate to use for lower right pixel

-> Float

ty2: y part of texture coordinate to use for left pixel

-> m () 

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.

Since: 1.0

rectangles

rectangles Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Float]

verts: an array of vertices

-> Word32

nRects: number of rectangles to draw

-> m () 

Draws a series of rectangles in the same way that rectangle does. In some situations it can give a significant performance boost to use this function rather than calling rectangle separately for each rectangle.

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

Since: 1.0

rectanglesWithTextureCoords

rectanglesWithTextureCoords Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Float]

verts: an array of vertices

-> Word32

nRects: number of rectangles to draw

-> m () 

Draws a series of rectangles in the same way that rectangleWithTextureCoords does. In some situations it can give a significant performance boost to use this function rather than calling rectangleWithTextureCoords separately for each rectangle.

verts should point to an array of floats with nRects * 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 rectangleWithTextureCoords.

Since: 0.8.6

rotate

rotate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

angle: Angle in degrees to rotate.

-> Float

x: X-component of vertex to rotate around.

-> Float

y: Y-component of vertex to rotate around.

-> Float

z: Z-component of vertex to rotate around.

-> m () 

Deprecated: (Since version 1.10)Use cogl_framebuffer_rotate() instead

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.

scale

scale Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

x: Amount to scale along the x-axis

-> Float

y: Amount to scale along the y-axis

-> Float

z: Amount to scale along the z-axis

-> m () 

Deprecated: (Since version 1.10)Use cogl_framebuffer_pop_matrix() instead

Multiplies the current model-view matrix by one that scales the x, y and z axes by the given values.

setBackfaceCullingEnabled

setBackfaceCullingEnabled Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

setting: True to enable backface culling or False to disable.

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_cull_face_mode() instead

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.

setDepthTestEnabled

setDepthTestEnabled Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

setting: True to enable depth testing or False to disable.

-> m () 

Deprecated: (Since version 1.16)Use cogl_pipeline_set_depth_state() instead

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.

setDrawBuffer

setDrawBuffer Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [BufferTarget]

target: A BufferTarget that specifies what kind of framebuffer you are setting as the render target.

-> Ptr ()

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

-> m () 

Deprecated: (Since version 1.16)The latest drawing apis take explicit CoglFramebuffer arguments so this stack of framebuffers shouldn't be used anymore.

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.

setFog

setFog Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

fogColor: The color of the fog

-> FogMode

mode: A FogMode that determines the equation used to calculate the fogging blend factor.

-> Float

density: Used by FogModeExponential and by FogModeExponentialSquared equations.

-> Float

zNear: Position along Z axis where no fogging should be applied

-> Float

zFar: Position along Z axis where full fogging should be applied

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet shader api for fog

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 zNear are drawn fully with their original color and vertices at zFar are drawn fully with fogColor. Fogging will remain enabled until you call disableFog.

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

setModelviewMatrix

setModelviewMatrix Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: the new model-view matrix

-> m () 

Deprecated: (Since version 1.10)Use cogl_framebuffer_set_modelview_matrix() instead

Loads matrix as the new model-view matrix.

setProjectionMatrix

setProjectionMatrix Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: the new projection matrix

-> m () 

Deprecated: (Since version 1.10)Use cogl_framebuffer_set_projection_matrix() instead

Loads matrix as the new projection matrix.

setSource

setSource Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

material: A Material

-> m () 

Deprecated: (Since version 1.16)Latest drawing apis all take an explicit CoglPipeline argument so this stack of Materials shouldn't be used.

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 rectangle or vertices drawn using vertexBufferDraw.

Since: 1.0

setSourceColor

setSourceColor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> m () 

Deprecated: (Since version 1.16)Latest drawing apis all take an explicit CoglPipeline argument so this stack of Materials shouldn't be used.

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 setSourceColor4ub and setSourceColor4f if you already have the color components.

Since: 1.0

setSourceColor4f

setSourceColor4f Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

red: value of the red channel, between 0 and 1.0

-> Float

green: value of the green channel, between 0 and 1.0

-> Float

blue: value of the blue channel, between 0 and 1.0

-> Float

alpha: value of the alpha channel, between 0 and 1.0

-> m () 

Deprecated: (Since version 1.16)Latest drawing apis all take an explicit CoglPipeline argument so this stack of Materials shouldn't be used.

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.

Since: 1.0

setSourceColor4ub

setSourceColor4ub Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word8

red: value of the red channel, between 0 and 255

-> Word8

green: value of the green channel, between 0 and 255

-> Word8

blue: value of the blue channel, between 0 and 255

-> Word8

alpha: value of the alpha channel, between 0 and 255

-> m () 

Deprecated: (Since version 1.16)Latest drawing apis all take an explicit CoglPipeline argument so this stack of Materials shouldn't be used.

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.

Since: 1.0

setSourceTexture

setSourceTexture Source #

Arguments

:: (HasCallStack, MonadIO m, IsTexture a) 
=> a

texture: The CoglTexture you want as your source

-> m () 

Deprecated: (Since version 1.16)Latest drawing apis all take an explicit CoglPipeline argument so this stack of Materials shouldn't be used.

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: <programlisting> 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); </programlisting>

Since: 1.0

setViewport

setViewport Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

x: X offset of the viewport

-> Int32

y: Y offset of the viewport

-> Int32

width: Width of the viewport

-> Int32

height: Height of the viewport

-> m () 

Deprecated: (Since version 1.8)Use cogl_framebuffer_set_viewport() instead

Replaces the current viewport with the given values.

Since: 1.2

shaderCompile

shaderCompile Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: CoglHandle for a shader.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

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.

shaderGetInfoLog

shaderGetInfoLog Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: CoglHandle for a shader.

-> m Text

Returns: a newly allocated string containing the info log. Use free to free it

Deprecated: (Since version 1.16)Use CoglSnippet api

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.

shaderGetType

shaderGetType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: CoglHandle for a shader.

-> m ShaderType

Returns: ShaderTypeVertex if the shader is a vertex processor or ShaderTypeFragment if the shader is a frament processor

Deprecated: (Since version 1.16)Use CoglSnippet api

Retrieves the type of a shader CoglHandle

shaderIsCompiled

shaderIsCompiled Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: CoglHandle for a shader.

-> m Int32

Returns: True if the shader object has sucessfully be compiled

Deprecated: (Since version 1.16)Use CoglSnippet api

Retrieves whether a shader CoglHandle has been compiled

shaderRef

shaderRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A CoglHandle to a shader.

-> m (Ptr ())

Returns: handle

Deprecated: (Since version 1.16)Use CoglSnippet api

Add an extra reference to a shader.

shaderSource

shaderSource Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

shader: CoglHandle for a shader.

-> Text

source: Shader source.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

Replaces the current source associated with a shader with a new one.

Please see <link linkend="cogl-Shaders-and-Programmable-Pipeline.description">above</link> for a description of the recommended format for the shader code.

shaderUnref

shaderUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A CoglHandle to a shader.

-> m () 

Deprecated: (Since version 1.16)Use CoglSnippet api

Removes a reference to a shader. If it was the last reference the shader object will be destroyed.

sqrti

sqrti Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

x: integer value

-> m Int32

Returns: integer square root.

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 SQRTI_ARG_5_PERCENT and less than 10% for narguments smaller than SQRTI_ARG_10_PERCENT. The maximum argument that can be passed to this function is SQRTI_ARG_MAX.

Since: 1.0

transform

transform Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: the matrix to multiply with the current model-view

-> m () 

Deprecated: (Since version 1.10)Use cogl_framebuffer_transform() instead

Multiplies the current model-view matrix by the given matrix.

Since: 1.4

translate

translate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

x: Distance to translate along the x-axis

-> Float

y: Distance to translate along the y-axis

-> Float

z: Distance to translate along the z-axis

-> m () 

Deprecated: (Since version 1.10)Use cogl_framebuffer_translate() instead

Multiplies the current model-view matrix by one that translates the model along all three axes according to the given values.

vertexBufferAdd

vertexBufferAdd Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A vertex buffer handle

-> Text

attributeName: 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) <itemizedlist> <listitem>"gl_Color"</listitem> <listitem>"gl_Normal"</listitem> <listitem>"gl_MultiTexCoord0, gl_MultiTexCoord1, ..."</listitem> <listitem>"gl_Vertex"</listitem> </itemizedlist> To support adding multiple variations of the same attribute the name can have a detail component, E.g. "gl_Color[active](#g:signal:active)" or "gl_Color[inactive](#g:signal:inactive)"

-> Word8

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

-> AttributeType

type: a AttributeType specifying the data type of each component.

-> Int32

normalized: 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.

-> Word16

stride: 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.

-> Ptr ()

pointer: This addresses the first attribute in the vertex array. This must remain valid until you either call vertexBufferSubmit or issue a draw call.

-> m () 

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

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 vertexBufferNew determines how many attribute values will be read from the supplied pointer.

The data for your attribute isn't copied anywhere until you call vertexBufferSubmit, 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 vertexBufferSubmit to commit the changes to the GPU. Be carefull to minimize the number of calls to vertexBufferSubmit, though.

<note>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: <programlisting> |-0-0-0-0-0-0-0-0-0-0| </programlisting> This is not ok: <programlisting> |- - - - -0-0-0-0-0-0 0 0 0 0| </programlisting> (Though you can have multiple groups of interleved attributes)</note>

vertexBufferDelete

vertexBufferDelete Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A vertex buffer handle

-> Text

attributeName: The name of a previously added attribute

-> m () 

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

Deletes an attribute from a buffer. You will need to call vertexBufferSubmit or issue a draw call to commit this change to the GPU.

vertexBufferDisable

vertexBufferDisable Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A vertex buffer handle

-> Text

attributeName: The name of the attribute you want to disable

-> m () 

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

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 vertexBufferSubmit after using this function.

vertexBufferDraw

vertexBufferDraw Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A vertex buffer handle

-> VerticesMode

mode: A VerticesMode specifying how the vertices should be interpreted.

-> Int32

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

-> Int32

count: Specifies the number of vertices you want to draw.

-> m () 

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

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.

vertexBufferDrawElements

vertexBufferDrawElements Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A vertex buffer handle

-> VerticesMode

mode: A VerticesMode specifying how the vertices should be interpreted.

-> Ptr ()

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

-> Int32

minIndex: Specifies the minimum vertex index contained in indices

-> Int32

maxIndex: Specifies the maximum vertex index contained in indices

-> Int32

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

-> Int32

count: Specifies the number of vertices you want to draw.

-> m () 

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

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.

vertexBufferEnable

vertexBufferEnable Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A vertex buffer handle

-> Text

attributeName: The name of the attribute you want to enable

-> m () 

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

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 vertexBufferSubmit after using this function

vertexBufferGetNVertices

vertexBufferGetNVertices Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A vertex buffer handle

-> m Word32

Returns: the number of vertices

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

Retrieves the number of vertices that handle represents

vertexBufferIndicesGetForQuads

vertexBufferIndicesGetForQuads Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

nIndices: the number of indices in the vertex buffer.

-> m (Ptr ())

Returns: A CoglHandle containing the indices. The handled is owned by Cogl and should not be modified or unref'd.

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

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 nIndices 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 <xref linkend="quad-indices-order"/> then you can request 6 indices to render two triangles like those shown in <xref linkend="quad-indices-triangles"/>.

<figure id="quad-indices-order"> <title>Example of vertices submitted to form a quad</title> <graphic fileref="quad-indices-order.png" format="PNG"/> </figure>

<figure id="quad-indices-triangles"> <title>Illustration of the triangle indices that will be generated</title> <graphic fileref="quad-indices-triangles.png" format="PNG"/> </figure>

vertexBufferIndicesGetType

vertexBufferIndicesGetType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

indices: An indices handle

-> m IndicesType

Returns: The CoglIndicesType used

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

Queries back the data type used for the given indices

vertexBufferNew

vertexBufferNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

nVertices: The number of vertices that your attributes will correspond to.

-> m (Ptr ())

Returns: a new CoglHandle

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

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

vertexBufferRef

vertexBufferRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: a coglHandle.

-> m (Ptr ())

Returns: the handle.

Deprecated: (Since version 1.2)Use cogl_object_ref() instead

Increment the reference count for a vertex buffer

vertexBufferSubmit

vertexBufferSubmit Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: A vertex buffer handle

-> m () 

Deprecated: (Since version 1.16)Use the CoglPrimitive api instead

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.

vertexBufferUnref

vertexBufferUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Ptr ()

handle: a coglHandle.

-> m () 

Deprecated: (Since version 1.2)Use cogl_object_unref() instead

Decrement the reference count for a vertex buffer

viewport

viewport Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

width: Width of the viewport

-> Word32

height: Height of the viewport

-> m () 

Deprecated: (Since version 1.8)Use cogl_framebuffer_set_viewport instead

Replace the current viewport with the given values.

Since: 0.8.2