# Candera V3.0.2

Release Date: February 19, 2015  
  
To keep backwards compatibility for any interface change in the public API the old interface has been kept and marked as deprecated. The deprecated interfaces will be removed in future versions. Compiler warnings will be generated when using a deprecated interface through the usage of Candera Macro CANDERA\_DEPRECATED\_3\_2\_0.

# Candera Engine Base

#### Resource Objects.

Large data buffers that need to be uploaded or that are rarely used are not longer directly stored in [DeviceObject](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_device_object.html "DeviceObject is the pure abstract base class for all objects which are able to upload or unload itsel...") objects. Instead, a [ResourceDataHandle](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_resource_data_handle.html "Object that stores information about access to large data buffers.") structure is stored, which can consist of one of :

<div class="contents" id="bkmrk-pointer-to-existing-"><div class="contents"><div class="textblock">- pointer to existing data, pointer to disposer function and size (backward compatible)
- information on where data can be found in asset and size
- custom information for custom ResourceProviders.

</div></div></div>ResourceObjects are objects that guarantee that during their lifetime, data referenced by a [ResourceDataHandle](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_resource_data_handle.html "Object that stores information about access to large data buffers.") is available.

<div class="contents" id="bkmrk-"><div class="contents"><div class="textblock">---

</div></div></div>#### Bitmap Resource Objects.

The pixel buffer is stored in the new [ResourceDataHandle](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_resource_data_handle.html "Object that stores information about access to large data buffers.") structure. See migration guide for an example on how it can be used.

<div class="contents" id="bkmrk--0"><div class="contents"><div class="textblock">---

</div></div></div>#### Introduce C++ keyword override in Candera

In a method declaration, override specifies that the function must be overriding a base class method.

The keyword override is part of C++ 11 standard and supported by MSVC 11 and gcc 4.7. It helps to prevent unintentional newly created functions, e.g. due to typos, that are intended to override virtual base function.

---

# Candera Engine 3D

#### Shader: Support for precompiled shaders on all enabled platforms.

Uploading shader programs using [Shader::Upload](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_device_object.html#a844bff65eb133e28e8cfb4132b12d840) can now be done in a more flexible way. Until now it was only possible to upload either shader source or pre-compiled binaries, through a target-specific implementation of RenderDevice::CompileAndLoadShaderPair.

Now it is possible to upload (and compile if necessary) either shader source or shader binary objects. It is even possible to upload complete shader programs in order to avoid shader linking. How shader upload is done depends on the kind of data that is available in the asset and the capabilities of the target platform, however at runtime this is done completely transparent to the user.

Advantage is that the more flexible way of runtime created shader source code (as used in Candera2D implementations over OpenGL ES) is supported as well as using pre-compiled shaders to save execution time for compiling them. While using pre-compiled shaders on enabled platform is recommended due to performance reasons, still backward compatibility to existing solutions using uncompiled shaders is given.

<div class="contents" id="bkmrk-"><div class="contents"><div class="textblock">---

</div></div></div>#### OpenGL ES 2 Reference Shaders relocated

The [Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]") OpenGL ES 2.0 [Shader](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_shader.html "The class Shader is an Appearance component representing a graphical processing unit (GPU) program...") language reference Shaders have been moved from   
 `<cgi_studio_candera>/src/Candera/Engine3D/ReferenceShaders`   
to `<cgi_studio_candera>/src/Candera/Engine3D/RefShaders/ESSL1`

<div class="contents" id="bkmrk--0"><div class="contents"><div class="textblock">---

</div></div></div>#### OpenGL ES 3 Reference Shaders

[Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]") now contains a set of reference Shaders for the OpenGL ES 3.0 [Shader](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_shader.html "The class Shader is an Appearance component representing a graphical processing unit (GPU) program...") language.   
`<cgi_studio_candera>/src/Candera/Engine3D/RefShaders/ESSL3`

<div class="contents" id="bkmrk--1"><div class="contents"><div class="textblock">---

</div></div></div>#### Shader Resource Objects.

Fragment and vertex shader data or access information is stored in the new [ResourceDataHandle](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_resource_data_handle.html "Object that stores information about access to large data buffers.") structure. See migration guide for an example on how it can be used.

<div class="contents" id="bkmrk--2"><div class="contents"><div class="textblock">---

</div></div></div>#### VertexGeometry Resource Objects.

The vertex, index and element format arrays are stored in the new [ResourceDataHandle](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_resource_data_handle.html "Object that stores information about access to large data buffers.") structure. See migration guide for an example on how it can be used.

<div class="contents" id="bkmrk--3"><div class="contents"><div class="textblock">---

</div></div></div>#### VertexBuffer primitive iteration.

Iteration over triangles is replaced by primitive iteration using a forward iterator, which is more performant, allows iteration over point and line primitives and supports multiple parallel iterations. See migration guide for an example on how it can be used.

<div class="contents" id="bkmrk--4"><div class="contents"><div class="textblock">---

</div></div></div>#### VertexBuffer vertex access.

Vertex access interface is moved from the [VertexBuffer](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_buffer.html "The VertexBuffer encapsulates the attributes of an uploaded VertexGeometry. It holds the actual handl...") to a separate class for better performance in case of vertex data accessed from assets. See migration guide for an example on how it can be used.

<div class="contents" id="bkmrk--5"><div class="contents"><div class="textblock">---

</div></div></div>#### 8/16/32 bit indexed array buffers.

[VertexGeometry](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_geometry.html "The VertexGeometry holds all vertex data of a mesh. VertexGeometry may be used also for multiple Vert...") accepts index buffers that consist of 8, 16 or 32 bit indexes. The configuration of index size can be set through the new values of BufferType enumeration: UInt8IndexedArrayBuffer, UInt16IndexedArrayBuffer and UInt32IndexedArrayBuffer.

<div class="contents" id="bkmrk--6"><div class="contents"><div class="textblock">---

</div></div></div>#### VertexElementFormat access.

VertexElementFormat access interface is moved from the [VertexGeometry](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_geometry.html "The VertexGeometry holds all vertex data of a mesh. VertexGeometry may be used also for multiple Vert...") to a separate class for better performance in case of vertex data accessed from assets. See migration guide for an example on how it can be used.

<div class="contents" id="bkmrk--7"><div class="contents"><div class="textblock">---

</div></div></div>#### VertexGeometryBuilder support for 8/16/32 bit index buffers.

[VertexGeometryBuilder](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_geometry_builder.html "The VertexGeometryBuilder helps effectively build VertexGeometry objects.") can create index buffers with values on 8, 16 or 32 bit, depending on the number of vetices, or on the configured format if explicitly set.

<div class="contents" id="bkmrk--8"><div class="contents"><div class="textblock">---

</div></div></div>#### BlendEquation Min/Max support.

Min/Max options were added to the [RenderMode](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_render_mode.html "The class RenderMode is an Appearance component that encapsulates polygon-level and per-fragment comp...") BlendEquation, which specifies how a new pixel is combined with previously rendered pixels in the frame buffer.

---

# Candera Engine 2D

#### Node2D Listener support.

[Node2DListener](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_node2_d_listener.html "A Node2DListener defines hooks that are called when certain Node functions are triggered, e.g. when a Node's transformation changes. In order to register a Node2DListener to a Node simply derive from Node2DListener and override pure virtual functions with custom code.") defines hooks that are called when certain [Node](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_node.html "The class Node is an abstract base class for all scene graph nodes. Each Node defines a local coordin...") functions are triggered, e.g. when a Node's transformation changes.

<div class="contents" id="bkmrk-"><div class="contents"><div class="textblock">---

</div></div></div>#### Auto Arrangement for GridLayouter

Two new methods available for [GridLayouter](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_grid_layouter.html "GridLayouter arranges its elements in a grid. The amount of rows and columns for the grid must be spe..."):

<div class="contents" id="bkmrk-gridlayouter%3A%3Asetgri"><div class="textblock">- [GridLayouter::SetGridAutoArrangement](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_grid_layouter.html#a293779ec4c742e1edd4d762cfc55bd9d) : sets the grid autoArrangement. See method description for possible layouter arrangement settings.
- [GridLayouter::GetGridAutoArrangement](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_grid_layouter.html#a89e23963c01aa7776c367c077f669a10): retrieves the grid autoArrangement settings of a given node, set by [GridLayouter::SetGridAutoArrangement](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_grid_layouter.html#a293779ec4c742e1edd4d762cfc55bd9d) method.

</div></div>---

# Candera System

#### Different namespace than 'Candera' for EnumDataTypes

```
#define ENUM_DATA_TYPE_NAMESPACE MyNamespace        // <-- new!

#define ENUM_DATA_TYPE \
    ENUM_DATA_TYPE_BEGIN(SomeEnum) \
        ENUM_DATA_TYPE_ITEM(SomeItem0) \
        ENUM_DATA_TYPE_ITEM_VALUE(SomeItem1, 4) \
        ENUM_DATA_TYPE_ITEM(SomeItem2) \
        ENUM_DATA_TYPE_ITEM_INVISIBLE(InvisibleItem) \
        ENUM_DATA_TYPE_ITEM_VALUE(SomeItem3, 7) \
    ENUM_DATA_TYPE_END(SomeEnum)

#include <Candera/System/MetaInfo/EnumDataType.h>
```

If ENUM\_DATA\_TYPE\_NAMESPACE is defined before including EnumDataType.h, the enum 'SomeEnum' will be placed into MyNamespace. Without that (ENUM\_DATA\_TYPE\_NAMESPACE is not defined), SomeEnum is placed automatically into namespace [Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]").

---

# Candera Device

#### Uniform Location Caching

Introduced Uniform Caching for Auto uniforms to increase performance. Calls to GetUniformLocation now pass semantic instead of names as parameter, which speeds up comparison within cache.

<div class="contents" id="bkmrk-"><div class="contents"><div class="textblock">---

</div></div></div>#### Maximum Element Index capability

RenderDeviceCapabilities structure contains a new field for the maximum value of vertex index that is supported by the device.

<div class="contents" id="bkmrk--0"><div class="contents"><div class="textblock">---

</div></div></div>#### RenderDevice::DrawVertexBuffer

RenderDevice::DrawVertexBuffer handles drawing of a [VertexBuffer](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_buffer.html "The VertexBuffer encapsulates the attributes of an uploaded VertexGeometry. It holds the actual handl..."), regadless of its configuration (primitive types, index formats, upload location).

<div class="contents" id="bkmrk--1"><div class="contents"><div class="textblock">---

</div></div></div>#### Added formats on DirectTextureImage

Additional formats have been added to DirectTextureImage::Format, unpacked RGBA and BGRA texture format.

<div class="contents" id="bkmrk--2"><div class="contents"><div class="textblock">---

</div></div></div>#### Shader Upload functions now support Upload of precompiled binary shaders.

The function RenderDevice::CompileAndLoadShaderPair only supports the fixed Upload of text or binary shader objects. In order to provide a more flexible handling of shader Upload, this function has been split up into RenderDevice::UploadShaderSource, RenderDevice::UploadShaderBinary and RenderDevice::UploadShaderBinaryProgram. Additionally the function RenderDevice::UploadShader has been added which calls the appropriate shader upload function transparently to the user. This interface enables the user to choose whether shader shall be available as binary or source shader objects.

---

# Candera AssetLoader

#### Resource Objects.

The font and raw resources are stored in the new [ResourceDataHandle](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_resource_data_handle.html "Object that stores information about access to large data buffers.") structure. See migration guide for an example on how it can be used.

<div class="contents" id="bkmrk-"><div class="contents"><div class="textblock">---

</div></div></div>#### Dispose after upload.

The dispose after upload feature of [DefaultAssetProvider](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_default_asset_provider.html "Implements objects handling mechanisms. It implements the interface AssetProvider and holds an asset ...") has become deprecated with the introduction of resource objects. The data is no longer attached to the device objects, but rather it is loaded from the asset upon necessity.

---

# TextEngine

#### Glyph Spacing

Glyph Spacing is available on [TextBrush](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_text_brush.html "Output alpha only glyph data. A color may be specified, which is applied to the color channels..."), and LayoutingOptions. This allows a user to correct the spacing between glyphs, by adding a specified number of pixels to the spaces between glyphs.

<div class="contents" id="bkmrk-"><div class="contents"><div class="textblock">---

</div></div></div>#### BitmapFont Engine

BitmapFont Engine is available for usage inside Candera-based applications. A bitmap font is essentially an image file which consists of several characters images and a header that depicts the size and location of each character inside the image. Each bitmap font might contain several fonts - mainly one font face with multiple sizes. One advantage of utilizing bitmap fonts is that the rendering to the screen requires very little resources and since each character is represented as a sub-texture, they can be reused without requiring additional memory on the GPU.

In order to use BitmapFonts, the CMake variable **CANDERA\_FONTENGINE** should be changed to *BitmapFont*.

<div class="contents" id="bkmrk--0"><div class="contents"><div class="textblock"><dl class="note"></dl>  
</div></div></div><p class="callout info">Harbuzz Text Shaper cannot be used with BitmapFont, either ComplexScriptLib or NoShaping should be chosen.</p>

This font engine uses a proprietary format to describe glyph bitmaps and glyph meta info. In order to use a bitmap font, provide an implementation for [Candera::TextRendering::FontStore](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_text_rendering_1_1_font_store.html "FontStore is an abstract interface to retrieve font data The font store defines unique descriptor id ...").

[Bitmap](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap.html "A 2-dimensional bitmap that can be used as a texture, background or sprite. A bitmap pointing to a va...") fonts require memory mapped assets. So, when the faces are loaded in be sure the storageType is set correctly:

`<a class="el" href="http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_text_rendering_1_1_font_resource_descriptor.html">TextRendering::FontResourceDescriptor</a> descriptor.storageType = <a class="el" href="http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_text_rendering_1_1_font_resource_descriptor.html#aeec8ca3513881b96d67a1af6d5c4c9ddadd7f609d0583effb6a0de5767427464e" title="the font data can be retrieved from a memory location">TextRendering::FontResourceDescriptor::MemoryResource</a>; `

#### Generating Bitmap Fonts

The following steps need to be considered:

<div class="contents" id="bkmrk-install-bitmap-font-"><div class="contents"><div class="textblock">- Install [Bitmap](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap.html "A 2-dimensional bitmap that can be used as a texture, background or sprite. A bitmap pointing to a va...") Font Generator from [http://www.angelcode.com/products/bmfont/](http://www.angelcode.com/products/bmfont/)

</div></div></div>Open the application. From the Options menu:

<div class="contents" id="bkmrk-choose-font-settings"><div class="contents"><div class="textblock">- Choose Font Settings. Set as needed the settings for "Font", "Add font file", "Size" etc.

- Configure the Export Options. Set "Font descriptor" to "XML" and Textures to "png - Portable Network Graphics"

- "Save bitmap font as ..."

</div></div></div>Convert the resulted XML and PNG files to binary format using the internal tool BmFontCreator using the following command:

<div class="contents" id="bkmrk-bmfontcreator.-exe--"><div class="contents"><div class="textblock">- BmFontCreator. exe -o MyFont32.fbm \*.fnt

</div></div></div><p class="callout info">A bitmap font should be used at its native pixel size. However, they are scalable because of the use of bitmaps, but only scaling down is recommended. In case of up scaling, the visual quality will be reduced. Including separate font sizes for bitmap fonts is possible in order to achieve the best looking results.</p>

<div class="contents" id="bkmrk--1"><div class="contents"><div class="textblock">---

</div></div></div>#### Glyph Substitution

A substitution character may be set within the style with the interface Style::SetDefaultCodepoint. This character is used by the text engine in any of the following situations:

<div class="contents" id="bkmrk-when-a-glyph-is-miss"><div class="contents"><div class="textblock">- when a glyph is missing from the style. i.e. no matching font can provide that glyph. Exception make control character, like newline or LRE.
- when UTF8 buffers contain malformed characters.

---

</div></div></div>#### Character Glyph Mapping

GlyphBitmap now contains information about the position within the text from where the glyphs originated, and the location of the glyph within the font.

<div class="contents" id="bkmrk--2"><div class="contents"><div class="textblock">---

</div></div></div>#### Glyph Order

The order in which glyphs are generated may be controlled by setting a property within the TextRenderContext. See TextRenderContext::GlyphOrder for details. This is most relevant when doing preprocessing. OriginalGlyphOrder is intended for use when intermediate measurements of the text are required, for instance when truncating texts. OrigitnalChunkOrder is more performant then [RenderOrder](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_render_order.html "Defines the order(sequence) in which nodes are rendered. Collaborates with Renderer. Must cover functional correctness (translucent/transparent objects after opaque/solid objects) as well as optimization-related orderings (sorting by state, defining a background bin for rendering without depth checks). Nodes are assigned to bins; all nodes in an "earlier" bin are rendered before all nodes in a "later" bin. Two default bins are defined and must not be deleted. The opaque bin, which is sorted from front to back (DistanceToCameraOrderCriterion), and the transparent bin, which is sorted from back to front (ReverseDistanceToCameraOrderCriterion). If a Node has no specific assignment to a render order bin, it will be automatically assigned by Candera either to opaque or transparent bin, according to its RenderMode::IsAlphaBlendingEnabled setting."), and is intende for measurements, where the order of the chunk is not important, for instance instance when computing layout rectangles. [RenderOrder](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_render_order.html "Defines the order(sequence) in which nodes are rendered. Collaborates with Renderer. Must cover functional correctness (translucent/transparent objects after opaque/solid objects) as well as optimization-related orderings (sorting by state, defining a background bin for rendering without depth checks). Nodes are assigned to bins; all nodes in an "earlier" bin are rendered before all nodes in a "later" bin. Two default bins are defined and must not be deleted. The opaque bin, which is sorted from front to back (DistanceToCameraOrderCriterion), and the transparent bin, which is sorted from back to front (ReverseDistanceToCameraOrderCriterion). If a Node has no specific assignment to a render order bin, it will be automatically assigned by Candera either to opaque or transparent bin, according to its RenderMode::IsAlphaBlendingEnabled setting.") shall be used when rendering.

<div class="contents" id="bkmrk--3"><div class="contents"><div class="textblock">---

</div></div></div>#### Text Preprocessing

The text engine allows text to be preprocessed by providing utility the class PreprocessingContext. This interface is satisfied by two concrete instances.

<div class="contents" id="bkmrk-minimalpreprocessing"><div class="textblock">- MinimalPreprocessingContext - stores all the information need to be able to render the glyphs.
- MaximalPreprocessingContext - stores all the information available within the text renderer for each glyph. [TextBrush](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_text_brush.html "Output alpha only glyph data. A color may be specified, which is applied to the color channels...") allows setting PreprocessedText instead of Text, to speed up text processing within the brush.

</div></div>---

# Migration Guide

Following an overview about interface changes between [Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]") V3.0.1 and [Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]") V3.0.2.

<div class="contents" id="bkmrk-description-candera-"><div class="textblock"><table class="doxtable" style="width: 100%;"><tbody><tr><th style="width: 17.0581%;">Description</th><th style="width: 24.2274%;">[Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]") V3.0.1</th><th style="width: 58.7145%;">[Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]") V3.0.2</th></tr><tr><td style="width: 17.0581%;">[Shader](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_shader.html "The class Shader is an Appearance component representing a graphical processing unit (GPU) program...") Resource Object</td><td style="width: 24.2274%;">const void\* fragmentShader = shader-&gt;GetFragmentShader(); const void\* vertexShader = shader-&gt;GetVertexShader();</td><td style="width: 58.7145%;">[Shader::ShaderResource](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_shader.html#adc9f14dc8275b2abb28609a7ea0bb8bd) fragmentShaderResource(shader-&gt;GetFragmentShaderResourceHandle()); const void\* fragmentShader = fragmentShaderResource.GetData();

[Shader::ShaderResource](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_shader.html#adc9f14dc8275b2abb28609a7ea0bb8bd) vertexShaderResource(shader-&gt;GetVertexShaderResourceHandle()); const void\* vertexShader = vertexShaderResource.GetData();

NOTE: data is guaranteed only until ShaderResource objects are destroyed by going out of scope.

</td></tr><tr><td style="width: 17.0581%;">Vertex Geometry Resource Object</td><td style="width: 24.2274%;">bool isGeometryMutable = vg-&gt;IsMutable();

const void\* vertexArray = vg-&gt;GetVertexArray(); void\* vertexArray = vg-&gt;GetVertexArray();

const UINT16\* indexArray = vg-&gt;GetIndexBuffer(); UINT16\* indexArray = vg-&gt;GetIndexBuffer();

const [VertexGeometry::VertexElementFormat](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_vertex_geometry_1_1_vertex_element_format.html)\* formatArray = vg-&gt;GetVertexElementFormat(); [VertexGeometry::VertexElementFormat](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_vertex_geometry_1_1_vertex_element_format.html)\* formatArray = vg-&gt;GetVertexElementFormat();

</td><td style="width: 58.7145%;">bool isVertexArrayMutable = vg-&gt;GetVertexArrayResourceHandle().m\_isMutable; [VertexGeometry::VertexArrayResource](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_geometry.html#a6bb0785e3d01adc05bac96f615df99bb) vertexArrayResource(vg-&gt;GetVertexArrayResourceHandle()); const void\* vertexArray = vertexArrayResource.GetData(); void\* vertexArray = vertexArrayResource.GetMutableData();

bool isIndexArrayMutable = vg-&gt;GetIndexArrayResourceHandle().m\_isMutable; [VertexGeometry::IndexArrayResource](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_geometry.html#a86282aeeac4b75f80b1ab9edee896a50) indexArrayResource(vg-&gt;GetIndexArrayResourceHandle()); const void\* indexArray = indexArrayResource.GetData(); void\* indexArray = indexArrayResource.GetMutableData();

bool isFormatArrayMutable = vg-&gt;GetFormatArrayResourceHandle().m\_isMutable; [VertexGeometry::FormatArrayResource](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_geometry.html#a648c208a147f20358b1d02a3fc417b4c) formatArrayResource(vg-&gt;GetFormatArrayResourceHandle()); const [VertexGeometry::VertexElementFormat](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_vertex_geometry_1_1_vertex_element_format.html)\* formatArray = formatArrayResource.GetData(); [VertexGeometry::VertexElementFormat](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_vertex_geometry_1_1_vertex_element_format.html)\* formatArray = formatArrayResource.GetMutableData();

NOTE: data is guaranteed only until resource objects are destroyed by going out of scope.

</td></tr><tr><td style="width: 17.0581%;">[Bitmap](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap.html "A 2-dimensional bitmap that can be used as a texture, background or sprite. A bitmap pointing to a va...") Resource Object</td><td style="width: 24.2274%;">bool isMutable = bitmap-&gt;IsMutable(); const void\* pixels = bitmap-&gt;GetPixels(); void\* pixels = bitmap-&gt;GetPixels();</td><td style="width: 58.7145%;">bool isMutable = bitmap-&gt;GetPixelsResourceHandle().m\_isMutable; [Bitmap::PixelsResource](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_bitmap.html#a2cbf2631c53346423ad38747c9e29d0f) pixlesResource(bitmap-&gt;GetPixelsResourceHandle()); const void\* pixels = pixlesResource.GetData(); void\* pixels = pixlesResource.GetMutableData();

NOTE: data is guaranteed only until resource objects are destroyed by going out of scope.

</td></tr><tr><td style="width: 17.0581%;">Font/Raw Resource Object</td><td style="width: 24.2274%;">ResourceHandle fontHandle = provider-&gt;OpenFontResourceById(fontId); if (fontHandle != 0) { UInt32 fontSize = provider-&gt;GetResourceSize(fontHandle); const void\* fontAdress = provider-&gt;GetResourceAddress(fontHandle); provider-&gt;ReadResource(fontHandle, fontData, 0, fontSize); provider-&gt;CloseResource(fontHandle); }</td><td style="width: 58.7145%;">[ResourceDataHandle](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_resource_data_handle.html "Object that stores information about access to large data buffers.") fontHandle = provider-&gt;GetFontResourceById(fontId); UInt32 fontSize = fontHandle.m\_size; const void\* fontAddress = ResourceData::GetAddress(fontHandle); ResourceData::CopyData(fontData, fontHandle, 0, fontSize);

NOTE: data is guaranteed only until resource objects are destroyed by going out of scope.

</td></tr><tr><td style="width: 17.0581%;">[VertexBuffer](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_buffer.html "The VertexBuffer encapsulates the attributes of an uploaded VertexGeometry. It holds the actual handl...") Primitive Iteration</td><td style="width: 24.2274%;">VertexBuffer\* vb; const VertexBuffer::Triangle\* triangle = vb-&gt;GetFirstTriangle(); while (triangle != 0) { UInt16 x = triangle-&gt;index\[0\]; UInt16 y = triangle-&gt;index\[1\]; UInt16 z = triangle-&gt;index\[2\]; triangle = vb-&gt;GetNextTriangle(); }</td><td style="width: 58.7145%;">VertexBuffer\* vb; for ([VertexBuffer::PrimitiveIterator](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_buffer.html#ad2b50cb0c10add8719aab668ac78706a) it = vb-&gt;GetPrimitiveIterator(); it.IsValid(); ++it) { const [VertexBuffer::Primitive](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_vertex_buffer_1_1_primitive.html)&amp; primitive = \*it; UInt16 x = primitive.m\_index\[0\]; UInt16 y = primitive.m\_index\[1\]; UInt16 z = primitive.m\_index\[2\]; }</td></tr><tr><td style="width: 17.0581%;">[VertexBuffer](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_buffer.html "The VertexBuffer encapsulates the attributes of an uploaded VertexGeometry. It holds the actual handl...") Vertex access</td><td style="width: 24.2274%;">VertexBuffer\* vb; const void\* vertex = vb-&gt;GetVertex(0); void\* mutableVertex = vb-&gt;GetMutableVertex(0);</td><td style="width: 58.7145%;">[VertexAccessor](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_accessor.html) accessor([VertexAccessor](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_vertex_accessor.html)(\*vb-&gt;GetVertexGeometry())); const void\* vertex = accessor.GetVertex(0); void\* mutableVertex = accessor.GetMutableVertex(0);</td></tr><tr><td style="width: 17.0581%;">VertexElementFormat access</td><td style="width: 24.2274%;">VertexGeometry\* vg; bool isPosition = vg-&gt;DoesVertexUsageExistAtUsageIndex(VertexGeometry::Position, 0); const [VertexGeometry::VertexElementFormat](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_vertex_geometry_1_1_vertex_element_format.html)\* positionElementFormat = vg-&gt;GetVertexElementFormatAtUsageAndUsageIndex(VertexGeometry::Position, 0);</td><td style="width: 58.7145%;">VertexGeometry\* vg; [ElementFormatAccessor](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_element_format_accessor.html) accessor = ElementFormatAccessor(\*vg); bool isPosition = (accessor.GetElementFormatByUsageAndIndex(VertexGeometry::Position, 0) != 0); const [VertexGeometry::VertexElementFormat](http://dev.doc.cgistudio.at/APILINK/struct_candera_1_1_vertex_geometry_1_1_vertex_element_format.html)\* positionElementFormat = accessor.GetElementFormatByUsageAndIndex(VertexGeometry::Position, 0);</td></tr><tr><td style="width: 17.0581%;">[Shader](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_shader.html "The class Shader is an Appearance component representing a graphical processing unit (GPU) program...") Upload</td><td style="width: 24.2274%;">const void\* fragmentShader = shader-&gt;GetFragmentShader(); const void\* vertexShader = shader-&gt;GetVertexShader(); Handle fragmentShaderHandle; Handle vertexShaderHandle; CompileAndLoadShaderPair(vertexShader, vertexShaderHandle, fragmentShader, fragmentShaderHandle);</td><td style="width: 58.7145%;">const void\* fragmentShader = shader-&gt;GetFragmentShader(); const void\* vertexShader = shader-&gt;GetVertexShader(); Handle fragmentShaderHandle; Handle vertexShaderHandle; [Shader::BuildType](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_shader.html#a06f170703f1baeb71dffd7cb9d645290) buildType; GetShaderBuildType(vertexShader, buildType); if (buildType == [Shader::ShaderSource](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_shader.html#a06f170703f1baeb71dffd7cb9d645290a44bb34d76f318ea9ccd702087be8da3a "Shader object is provided as source code.")) { UploadShaderSource(Shader::VertexShader, vertexShader, vertexShaderHandle); } else { ... } GetShaderBuildType(fragmentShader, buildType); if (buildType == [Shader::ShaderSource](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_shader.html#a06f170703f1baeb71dffd7cb9d645290a44bb34d76f318ea9ccd702087be8da3a "Shader object is provided as source code.")) { UploadShaderSource(Shader::FragmentShader, fragmentShader, fragmentShaderHandle); } else { ... }

Note: This is normally done transparently by [Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]").

</td></tr></tbody></table>

</div></div>---

# CGI-Studio CMake Configuration

<div class="contents" id="bkmrk-the-cmake-macro-cgic"><div class="textblock">- The CMake macro `CgiCreateWidgetSet` now creates an empty WidgetSet if no additional widgets have been added.
- `-m32` has been added as default compiler flag for gcc builds to ensure compilation even on x64 gcc.
- With update of Attribute Caching the user variable CANDERA\_MAX\_SHADER\_ATTRIBUTE\_COUNT became obsolete and has been deleted.

</div></div>---