# 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>---