# A3DGlobalInsertGraphMaterial

A3DStatus `A3DGlobalInsertGraphMaterial`(const A3DGraphMaterialData *pData, A3DUns32 *puiIndexMaterial)
  `A3DStatus` A3DGlobalInsertGraphMaterial(const `A3DGraphMaterialData`* pData, `A3DUns32`* puiIndexMaterial)

  Creates a new material, returning its index.

  > 2.0

  When given an `A3DGraphMaterialData`, the function searches for an already existing material data of the same value and returns its index. If the material does not exist, it is created and a new index is returned. In case of failure `*puiIndexMaterial`is unchanged.

      A3DGraphMaterialDatamaterial_data=A3D_MAKE_DATA(A3DGraphMaterialData);
      A3DUns32idx_0=A3D_DEFAULT_MATERIAL_INDEX;

      A3DStatusresult=A3DGlobalInsertGraphMaterial(&material_data,&idx_0);
      assert(result==A3D_SUCCESS);

      Secondinsertionwiththesamedata,expectindextobethesame.
      A3DUns32idx_1=A3D_DEFAULT_MATERIAL_INDEX;
      result=A3DGlobalInsertGraphMaterial(&material_data,&idx_1);
      assert(result==A3D_SUCCESS);
      assert(idx_0==idx_1);

  Parameters

  > pData: The material data to insert.

  > puiIndexMaterial: The resulting index for the input color.

  Returns

  > A3D_SUCCESS or an error code.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Exchange in your own language, or choose a sample question below to start a conversation:

What is HOOPS Exchange?
What are the latest release notes for HOOPS Exchange?
How do I start evaluating HOOPS Exchange?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...