All Projects โ†’ alaingalvan โ†’ CrossWindow-Graphics

alaingalvan / CrossWindow-Graphics

Licence: MIT License
A header only library to simplify creating ๐ŸŒ‹ Vulkan / โšช OpenGL / ๐ŸŒ WebGL / โŽDirectX / ๐Ÿค– Metal data structures with CrossWindow.

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to CrossWindow-Graphics

LowLevelAPIDemo
Evergine Low-Level API samples.
Stars: โœญ 12 (-75%)
Mutual labels:  metal, vulkan, directx
virtualGizmo3D
Virtual GIZMO - 3D object manipulator / orientator, via mouse, with pan and dolly/zoom features
Stars: โœญ 36 (-25%)
Mutual labels:  metal, vulkan, directx
bgfx-header-extension-library
Header-only effects and helper library for Bgfx to help you hit the ground running. Includes a bunch of post processing filters to complete common graphical tasks
Stars: โœญ 35 (-27.08%)
Mutual labels:  metal, vulkan, directx
spirv cross
Safe Rust wrapper around SPIRV-Cross
Stars: โœญ 75 (+56.25%)
Mutual labels:  metal, vulkan, directx
Bgfx
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
Stars: โœญ 10,252 (+21258.33%)
Mutual labels:  metal, vulkan, directx
CrossWindow-Demos
๐Ÿฅช Examples of how to use CrossWindow for things like rendering graphics, listening to events, etc.
Stars: โœญ 48 (+0%)
Mutual labels:  metal, vulkan, directx
RavEngine
A fast, easy to use C++20 3D game library for modern computers
Stars: โœญ 122 (+154.17%)
Mutual labels:  metal, vulkan, directx
wgpu-mc
Rust-based replacement for the default Minecraft renderer
Stars: โœญ 254 (+429.17%)
Mutual labels:  metal, vulkan, directx
Llgl
Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal
Stars: โœญ 1,011 (+2006.25%)
Mutual labels:  metal, vulkan, directx
Fiber2d
Cross-platform 2D Game Engine in pure Swift
Stars: โœญ 415 (+764.58%)
Mutual labels:  metal, vulkan, directx
The Forge
The Forge Cross-Platform Rendering Framework PC Windows, Linux, Ray Tracing, macOS / iOS, Android, XBOX, PS4, PS5, Switch, Quest 2
Stars: โœญ 2,710 (+5545.83%)
Mutual labels:  metal, vulkan, directx
Crossshader
โš”๏ธ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.
Stars: โœญ 113 (+135.42%)
Mutual labels:  metal, vulkan, directx
bgfx-python
Python 3.7+ wrapper for the BGFX library. ๐Ÿ
Stars: โœญ 99 (+106.25%)
Mutual labels:  metal, vulkan, directx
Mg
C# Vulkan interface/polyfill for WINDOWS and MacOS
Stars: โœญ 19 (-60.42%)
Mutual labels:  metal, vulkan
pygfx
Like ThreeJS but for Python and based on wgpu
Stars: โœญ 72 (+50%)
Mutual labels:  metal, vulkan
Explosion
๐Ÿ’ฅ A modern cross-platform game engine (WIP)
Stars: โœญ 102 (+112.5%)
Mutual labels:  metal, vulkan
wgpu-py
Next generation GPU API for Python
Stars: โœญ 210 (+337.5%)
Mutual labels:  metal, vulkan
game overlay sdk
Library to write messages on top of game window
Stars: โœญ 57 (+18.75%)
Mutual labels:  vulkan, directx
YALCT
Yet Another Live Coding Tool - Powered by Veldrid and elbow grease
Stars: โœญ 25 (-47.92%)
Mutual labels:  metal, vulkan
harfang3d
HARFANG 3D source code public repository
Stars: โœญ 173 (+260.42%)
Mutual labels:  vulkan, directx

CrossWindow-Graphics

cmake-img License

A header only library to simplify creating and managing data structures needed for graphics APIs such as a Vulkan vk::Surface, an OpenGL context, a DirectX IDXGISwapChain1, or Metal CAMetalLayer.

Supports

  • ๐ŸŒ‹ Vulkan
  • โšช OpenGL
  • โšช OpenGL ES
  • ๐ŸŒ WebGL
  • โŽ DirectX 12.x
  • โœ–๏ธ DirectX 11.x
  • ๐Ÿค– Metal

Installation

First add the repo as a submodule in your dependencies folder such as external/:

cd external
git submodule add https://github.com/alaingalvan/crosswindow-graphics.git

Then in your CMakeLists.txt file, include the following:

add_subdirectory(external/crosswindow-graphics)

target_link_libraries(
    ${PROJECT_NAME}
    CrossWindowGraphics
)

Usage

#include "CrossWindow/CrossWindow.h"
#include "CrossWindow/Graphics.h"

void xmain(int argc, char** argv)
{
  // ๐Ÿ–ผ๏ธ Create your xwin::Window...
  xwin::Window window;
  
  // ...
  
#if defined(XGFX_VULKAN)
  
  // ๐ŸŒ‹ Vulkan Surface
  vk::Surface surface = xwin::createSurface(&window, instance);

#elif defined(XGFX_OPENGL)

  // โšช OpenGL / OpenGL ES / ๐ŸŒ WebGL platform specific context data
  xwin::OpenGLDesc desc;
  xwin::OpenGLState state = xwin::createContext(&window, desc);

  // โฌ‡๏ธ Set the context
  xwin::setContext(state);

  // ๐Ÿ”€ Refresh your window
  xwin::swapBuffers(state);

  // โฌ†๏ธ Unset the context
  xwin::unsetContext(state);

  // โฌ…๏ธ Destroy the context
  xwin::destroyContext(state);

#elif defined(XGFX_DIRECTX12)

  // โŽ DirectX 12.x Swapchain
  IDXGISwapChain1* swapchain = xgfx::createSwapchain(window, factory, commandQueue, &swapchainDesc);

#elif defined(XGFX_DIRECTX11)

  // โœ–๏ธ DirectX 11.x Swapchain
  IDXGISwapChain* swapchain = xgfx::createSwapchain(window, factory, device, &swapchainDesc);

#elif defined(XWIN_METAL)

  // ๐Ÿค– Metal Layer
  xwin::createMetalLayer(&window);

  // ๐Ÿฎ Access the layer from your window
  CAMetalLayer* layer = (CAMetalLayer*)window.layer;

#endif
}

Preprocessor Definitions

CMake Options Description
XGFX_API The graphics API you're targeting, defaults to VULKAN, can be can be VULKAN, OPENGL, DIRECTX12, METAL, or NONE.

Alternatively you can set the following preprocessor definitions manually:

Definition Description
XGFX_VULKAN Vulkan
XGFX_OPENGL OpenGL / OpenGL ES / WebGL
XGFX_DIRECTX12 DirectX 12.x
XGFX_DIRECTX11 DirectX 11.x
XGFX_METAL Metal

Design Decisions

The official Khronos Group's Vulkan Samples features an OpenGL driver info example and Vulkan cube example that the OpenGL/Vulkan portions of this library pull heavily from, but diverges with the decision to separate operating systems by protocol (similar to the design of CrossWindow).

You can read more in our docs.

License

CrossWindow is licensed as either MIT or Apache-2.0, whichever you would prefer.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].