| 54 | } |
| 55 | |
| 56 | void Load(winrt::hstring const& /*entryPoint*/) |
| 57 | { |
| 58 | LLGL::Log::RegisterCallbackStd(); |
| 59 | |
| 60 | // Load render system module |
| 61 | LLGL::Report report; |
| 62 | renderer = LLGL::RenderSystem::Load("Direct3D11", &report); |
| 63 | if (!renderer) |
| 64 | { |
| 65 | LLGL::Log::Errorf("%s", report.GetText()); |
| 66 | return; |
| 67 | } |
| 68 | |
| 69 | // Create swap-chain |
| 70 | LLGL::SwapChainDescriptor swapChainDesc; |
| 71 | { |
| 72 | swapChainDesc.resolution = { 800, 600 }; |
| 73 | swapChainDesc.depthBits = 0; // We don't need a depth buffer for this example |
| 74 | swapChainDesc.stencilBits = 0; // We don't need a stencil buffer for this example |
| 75 | swapChainDesc.samples = 8; |
| 76 | } |
| 77 | swapChain = renderer->CreateSwapChain(swapChainDesc); |
| 78 | |
| 79 | // Print renderer information |
| 80 | const auto& info = renderer->GetRendererInfo(); |
| 81 | |
| 82 | LLGL::Log::Printf( |
| 83 | "Renderer: %s\n" |
| 84 | "Device: %s\n" |
| 85 | "Vendor: %s\n" |
| 86 | "Shading Language: %s\n" |
| 87 | "Swap Chain Format: %s\n" |
| 88 | "Depth/Stencil Format: %s\n", |
| 89 | info.rendererName.c_str(), |
| 90 | info.deviceName.c_str(), |
| 91 | info.vendorName.c_str(), |
| 92 | info.shadingLanguageName.c_str(), |
| 93 | LLGL::ToString(swapChain->GetColorFormat()), |
| 94 | LLGL::ToString(swapChain->GetDepthStencilFormat()) |
| 95 | ); |
| 96 | |
| 97 | // Set window title and show window |
| 98 | window = LLGL::CastTo<LLGL::Window>(&swapChain->GetSurface()); |
| 99 | |
| 100 | window->SetTitle("LLGL Example: Hello UWP"); |
| 101 | |
| 102 | // Vertex data structure |
| 103 | struct Vertex |
| 104 | { |
| 105 | float position[2]; |
| 106 | uint32_t color; |
| 107 | }; |
| 108 | |
| 109 | // Vertex data (3 vertices for our triangle) |
| 110 | Vertex vertices[] = |
| 111 | { |
| 112 | { { 0.0f, +0.5f }, 0xFF0000FF }, // red |
| 113 | { { +0.5f, -0.5f }, 0xFF00FF00 }, // green |
no test coverage detected