kaleido3d is a cross-platform graphics library.
- Modern Graphics Renderer (
Metal
,Vulkan
,Direct3D 12
)- Task-Oriented, support
multi-thread
rendering- Support Windows/UWP, Android, iOS, MacOS & Linux.
Windows & UWP & Android | MacOS/iOS/Linux | |
---|---|---|
CI Status | ||
IDE | VS2015+ & Android Studio 3.0+ | Xcode 8.1+ |
OS Requirements | Win10 & Android 7.+ | MacOS Sierra |
- Python 2.7
- CMake 3.x
Draw a triangle
void DrawFrame()
{
auto currentImage = m_pSwapChain->GetCurrentTexture();
auto ImageDesc = currentImage->GetDesc();
k3d::ColorAttachmentDesc ColorAttach;
ColorAttach.pTexture = currentImage;
// specify renderpass action, optimize for mobile platform's PLS (Pixel Local Storage)
ColorAttach.LoadAction = k3d::ELA_Clear;
ColorAttach.StoreAction = k3d::ESA_Store;
ColorAttach.ClearColor = Vec4f(1, 1, 1, 1);
k3d::RenderPassDesc Desc;
Desc.ColorAttachments.Append(ColorAttach);
auto commandBuffer = m_pQueue->ObtainCommandBuffer(k3d::ECMDUsage_OneShot);
// command encoder is similar to apple's metal, look up renderpass object from cache
// for vulkan, it performs the call "BeginRenderPass"
auto renderCmd = commandBuffer->RenderCommandEncoder(Desc);
renderCmd->SetBindingGroup(m_BindingGroup);
k3d::Rect rect{ 0, 0, ImageDesc.TextureDesc.Width, ImageDesc.TextureDesc.Height };
renderCmd->SetScissorRect(rect);
renderCmd->SetViewport(k3d::ViewportDesc(ImageDesc.TextureDesc.Width, ImageDesc.TextureDesc.Height));
renderCmd->SetPipelineState(0, m_pPso);
renderCmd->SetIndexBuffer(m_TriMesh->IBO());
renderCmd->SetVertexBuffer(0, m_TriMesh->VBO());
renderCmd->DrawIndexedInstanced(k3d::DrawIndexedInstancedParam(3, 1));
renderCmd->EndEncode();
commandBuffer->Present(m_pSwapChain, m_pFence);
commandBuffer->Commit(m_pFence);
}
If you have any suggestion, please contact me via email .
Please join the gitter chat or QQ Group to discuss on this project. Framework development discussions and thorough bug reports are collected on Issues.
ThirdParty Libraries:
- OpenSSL (Core)
- PCRE2 (Core)
- Snappy (Core)
- ZLib (Core)
- Vulkan Memory Allocator (NGFX)
- FreeType (ShaderCompiler)
- Glslang (ShaderCompiler)
- SPIRV-CROSS (ShaderCompiler)
- SPIRV-TOOLS (ShaderCompiler)
- LLVM (Reflection)
- Clang (Reflection)
- GoogleV8 (Script)
- GoogleTest (Unit Test)
- rapidjson
- imobiledevice (MobileDevice)