🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Diligent Engine is now available in C

Started by
0 comments, last by DiligentDev 4 years, 4 months ago

C API has always been one of the most frequently requested DiligentEngine's features, and it has finally been adopted!

Check out reworked Tutorial03_Texturing that demonstrates the usage of the new API.

This is what it looks like:

// 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
// makes sure that resources are transitioned to required states.
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);

This topic is closed to new replies.

Advertisement