Diligent Graphics > Uncategorized > Diligent Engine now has C API
Diligent Engine now has C API
C API has always been one of the most frequently requested features, and it has finally been adopted!
Check out the reworked Tutorial 03 that demonstrates the usage of the new API. This is what it looks like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
// Bind vertex and index buffers Uint32 offset = 0; IBuffer* pBuffs[1]; pBuffs[0] = g_pCubeVertexBuffer; IDeviceContext_SetVertexBuffers(pContext, 0, 1, pBuffs, &offset, RESOURCE_STATE_TRANSITION_MODE_TRANSITION, SET_VERTEX_BUFFERS_FLAG_RESET); IDeviceContext_SetIndexBuffer(pContext, g_pCubeIndexBuffer, 0, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); // Set the pipeline state IDeviceContext_SetPipelineState(pContext, g_pPSO); // Commit shader resources. RESOURCE_STATE_TRANSITION_MODE_TRANSITION mode IDeviceContext_CommitShaderResources(pContext, g_pSRB, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); DrawIndexedAttribs DrawAttrs; memset(&DrawAttrs, 0, sizeof(DrawAttrs)); DrawAttrs.IndexType = VT_UINT32; // Index type DrawAttrs.NumIndices = 36; DrawAttrs.NumInstances = 1; // Verify the state of vertex and index buffers DrawAttrs.Flags = DRAW_FLAG_VERIFY_ALL; IDeviceContext_DrawIndexed(pContext, &DrawAttrs); |