- NOTE: This repository receives bug fixes only, but no major updates. Pull requests may still be accepted.
- Version: 0.03 Beta (see ChangeLog)
- Getting Started with LLGL (PDF) with Introduction, Hello Triangle Tutorial, and Extensibility Example with GLFW
- LLGL Reference Manual (PDF)
- LLGL Coding Conventions (PDF)
- Examples and Tutorials for C++
- Examples for C#
Platform | CI | D3D12 | D3D11 | Vulkan | OpenGL | OpenGLES 3 | Metal |
---|---|---|---|---|---|---|---|
Windows | ✔️ | ✔️ | ✔️ | ✔️ | N/A | N/A | |
GNU/Linux | N/A | N/A | ✔️ | ✔️ | N/A | N/A | |
macOS | N/A | N/A | N/A | ✔️ | N/A | ✔️ | |
iOS | N/A | N/A | N/A | N/A | ✖️ | ✔️ | |
Android | N/A | N/A | ✖️ | N/A | ✔️ | N/A |
Build scripts are provided for CMake.
Visual Studio 2015 or later is required to build LLGL on Windows.
Xcode 9 or later is required to build LLGL on macOS and iOS.
The following development libraries are required to build LLGL on GNU/Linux:
- X11:
libx11-dev
- Xrandr:
libxrandr-dev
The Android NDK with at least API level 21 is required. The build script to generate project files is currently only supported on GNU/Linux and requires CMake 3.10 or later and the Code::Blocks IDE.
This platform support is currently in an experimental state.
Alternatively, you can build and install LLGL using vcpkg dependency manager:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install llgl
The llgl port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.
// Unified Interface:
CommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex);
// OpenGL Implementation:
void GLCommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
const GLintptr indices = (renderState_.indexBufferOffset + firstIndex * renderState_.indexBufferStride);
glDrawElements(
renderState_.drawMode,
static_cast<GLsizei>(numIndices),
renderState_.indexBufferDataType,
reinterpret_cast<const GLvoid*>(indices)
);
}
// Direct3D 11 Implementation
void D3D11CommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
context_->DrawIndexed(numIndices, firstIndex, 0);
}
// Direct3D 12 Implementation
void D3D12CommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
commandList_->DrawIndexedInstanced(numIndices, 1, firstIndex, 0, 0);
}
// Vulkan Implementation
void VKCommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
vkCmdDrawIndexed(commandBuffer_, numIndices, 1, firstIndex, 0, 0);
}
// Metal implementation
void MTCommandBuffer::DrawIndexed(std::uint32_t numIndices, std::uint32_t firstIndex) {
if (numPatchControlPoints_ > 0) {
[renderEncoder_
drawIndexedPatches: numPatchControlPoints_
patchStart: static_cast<NSUInteger>(firstIndex) / numPatchControlPoints_
patchCount: static_cast<NSUInteger>(numIndices) / numPatchControlPoints_
patchIndexBuffer: nil
patchIndexBufferOffset: 0
controlPointIndexBuffer: indexBuffer_
controlPointIndexBufferOffset: indexTypeSize_ * (static_cast<NSUInteger>(firstIndex))
instanceCount: 1
baseInstance: 0
];
} else {
[renderEncoder_
drawIndexedPrimitives: primitiveType_
indexCount: static_cast<NSUInteger>(numIndices)
indexType: indexType_
indexBuffer: indexBuffer_
indexBufferOffset: indexTypeSize_ * static_cast<NSUInteger>(firstIndex)
];
}
}