Jump to content

In 1.03 after a last update 3D camera renders a black screen when there is a UI camera


Go to solution Solved by Josh,

Recommended Posts

Posted

Example:

#include "UltraEngine.h"

using namespace UltraEngine;


int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1920, 1080, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

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

    //Create a world
    auto world = CreateWorld();

    //Create a camera    
    auto camera = CreateCamera(world);
    camera->SetClearColor(0.6);
    camera->SetFov(90);
    camera->SetRotation(54.736f, 45, 0);
    camera->SetPosition(0, 4, 0);

    auto sz = framebuffer->GetSize();

    // Load a font
    auto font = LoadFont("Fonts/arial.ttf");

    // Create user interface
    auto ui = CreateInterface(world, font, framebuffer->GetSize());
    ui->SetRenderLayers(2);
    ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f);

    // Create ui camera
    auto uiCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    uiCamera->SetPosition(float(framebuffer->GetSize().x) * 0.5f, float(framebuffer->GetSize().y) * 0.5f, 0);
    uiCamera->SetRenderLayers(2);
    uiCamera->SetClearMode(CLEAR_DEPTH);

    //Create light
    auto light = CreateBoxLight(world);
    light->SetRange(-100, 100);
    light->SetArea(100, 100);
    light->SetRotation(35, 35, 0);
    light->SetColor(2);

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {  
        world->Update();
        world->Render(framebuffer, false);
    }
    return 0;
}

 

Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

Posted

It's the GUI background you are seeing. What was the behavior before? Did panels use alpha blending?

#include "UltraEngine.h"

using namespace UltraEngine;


int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1024, 768, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

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

    //Create a world
    auto world = CreateWorld();

    //Create a camera    
    auto camera = CreateCamera(world);
    camera->SetClearColor(0,0,1);
    
    auto sz = framebuffer->GetSize();

    // Load a font
    auto font = LoadFont("Fonts/arial.ttf");

    // Create user interface
    auto ui = CreateInterface(world, font, framebuffer->GetSize());
    ui->SetRenderLayers(2);
    ui->root->SetColor(1,0,0,0);

    // Create ui camera
    auto uiCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    uiCamera->SetClearMode(CLEAR_DEPTH);
    uiCamera->SetRenderLayers(2);

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        world->Update();
        world->Render(framebuffer, false);
    }
    return 0;
}

 

Let's build cool stuff and have fun. :)

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.

×
×
  • Create New...