Jump to content

Icons not visible anymore in real time after last updates in beta branch


Dreikblack
 Share

Go to solution Solved by Josh,

Recommended Posts

Press space to show panel with icon

#include "UltraEngine.h"

using namespace UltraEngine;

shared_ptr<Window> window;
shared_ptr<Framebuffer> framebuffer;
shared_ptr<World> menuWold;
shared_ptr<Interface> ui;
shared_ptr<Camera> uiCamera;

shared_ptr<Widget> panel;
shared_ptr<Icon> icon1;
shared_ptr<Icon> icon2;

bool isFirst = true;

void initGui() {
    auto default_font = LoadFont("Fonts\\arial.ttf");
    ui = CreateInterface(menuWold, default_font, framebuffer->GetSize());
    ui->SetRenderLayers(2);
    ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f);
    uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC);
    uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0);
    uiCamera->SetRenderLayers(2);
    uiCamera->SetClearMode(CLEAR_DEPTH);

    panel = CreatePanel(10, 50, 64, 64, ui->root, PANEL_DEFAULT);
    icon1 = LoadIcon("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Icons/help.svg");
    icon2 = LoadIcon("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Icons/new.svg");
}


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

    //Create a window
    window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_DEFAULT);

    //Create a world
    menuWold = CreateWorld();
    menuWold->RecordStats();

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

    //Create light
    auto light = CreateBoxLight(menuWold);
    light->SetRange(-10, 10);
    light->SetRotation(15, 15, 0);
    light->SetColor(2);

    //Create camera
    auto camera = CreateCamera(menuWold);
    camera->SetClearColor(0.125);
    camera->SetPosition(0, 0, -3);
    camera->SetFov(70);

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) {
        if (window->KeyHit(KEY_SPACE)) {
            if (!ui) initGui();
            isFirst = !isFirst;
            if (isFirst) {
                panel->SetIcon(icon1);
            } else {
                panel->SetIcon(icon2);
            }

        }
        window->SetText("FPS: " + String(menuWold->renderstats.framerate));
        menuWold->Update();
        menuWold->Render(framebuffer, false);
    }
    return 0;
}

 

Link to comment
Share on other sites

Thanks, I will check this out tomorrow. This is very likely just a small shader error. The entity data layout was modified to add more information. I did test a GUI sample, but it did not use an icon.

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

It's actually not a problem with clipping region, which was my initial guess. The texture is on that block is being read in the shader and the block is showing up. The application just seems to be reading (0,0,0,0) for the color, for some reason. Texture coordinates look correct as well...

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...