Jump to content

Post-processing effects show black screen first two frames


Josh
 Share

Go to solution Solved by Josh,

Recommended Posts

After a swap chain is created, if post-processing effects are enabled, it will take three calls to World::Render before anything except a black screen will appear.

Related thread:

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    EngineSettings settings;
    settings.asyncrender = false;
    Initialize(settings);

    //Get the displays
    auto displays = GetDisplays();

    //Create window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_RESIZABLE | WINDOW_CENTER | WINDOW_TITLEBAR);

    //Create world
    auto world = CreateWorld();

    //Create framebuffer
    auto framebuffer = CreateFramebuffer(window);

    //Create a camera
    auto camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    camera->SetClearColor(0,0,1,1);
    camera->SetDepthPrepass(false);

    auto fx = LoadPostEffect("Shaders/FXAA.fx");
    camera->AddPostEffect(fx);

    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        auto e = WaitEvent();

        if (e.id == EVENT_KEYDOWN and e.data == KEY_SPACE)
        {
            camera->SetClearColor(Random(), Random(), Random());
            world->Update();
            world->Render(framebuffer);
        }
    }
    return 0;
}

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 5 months later...
  • Solution

Fixed in 0.9.5, or may be a Windows compositor issue.

I found what works best is do a render before showing the window, show the window, then do one more render.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...