MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / DrawSceneOntoScreen

Function DrawSceneOntoScreen

deps/LLGL/examples/Cpp/RenderTarget/Example.cpp:461–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459 }
460
461 void DrawSceneOntoScreen()
462 {
463 #ifndef ENABLE_CBUFFER_RANGE
464
465 // Update model transformation with standard projection
466 Settings settings;
467 UpdateSettingsForScreen(settings);
468 commands->UpdateBuffer(*constantBuffer, 0, &settings, sizeof(settings));
469
470 #endif // /ENABLE_CBUFFER_RANGE
471
472 // Generate MIP-maps again after texture has been written by the render-target
473 commands->GenerateMips(*renderTargetTex);
474
475 // Begin render pass for render context
476 commands->BeginRenderPass(*context);
477 {
478 // Clear color and depth buffers of active framebuffer (i.e. the screen)
479 commands->SetClearColor(backgroundColor);
480 commands->Clear(LLGL::ClearFlags::ColorDepth);
481
482 // Binds graphics pipeline for render context
483 commands->SetPipelineState(*pipelines[1]);
484
485 // Set viewport to fullscreen.
486 // Note: this must be done AFTER the respective graphics pipeline has been set,
487 // since the previous pipeline has no dynamic viewport!
488 commands->SetViewport(context->GetResolution());
489
490 if (resourceHeap)
491 {
492 // Set graphics pipeline resources
493 commands->SetResourceHeap(*resourceHeap, 1);
494 }
495 else
496 {
497 #ifdef ENABLE_CUSTOM_MULTISAMPLING
498
499 // Set multi-sample render-target texture
500 commands->SetResource(*renderTargetTex, 1, LLGL::BindFlags::Sampled, shaderStages);
501
502 #else
503
504 // Set render-target texture
505 commands->SetResource(*renderTargetTex, 2, LLGL::BindFlags::Sampled, shaderStages);
506
507 #endif // /ENABLE_CUSTOM_MULTISAMPLING
508 }
509
510 // Draw scene
511 commands->DrawIndexed(36, 0);
512 }
513 commands->EndRenderPass();
514 }
515
516 #ifdef ENABLE_CBUFFER_RANGE
517

Callers 1

OnDrawFrameFunction · 0.85

Calls 13

UpdateSettingsForScreenFunction · 0.85
UpdateBufferMethod · 0.45
GenerateMipsMethod · 0.45
BeginRenderPassMethod · 0.45
SetClearColorMethod · 0.45
ClearMethod · 0.45
SetPipelineStateMethod · 0.45
SetViewportMethod · 0.45
GetResolutionMethod · 0.45
SetResourceHeapMethod · 0.45
SetResourceMethod · 0.45
DrawIndexedMethod · 0.45

Tested by

no test coverage detected