SpiderPig Posted November 21, 2023 Share Posted November 21, 2023 While the example here works, it seems if you are overlaying an interface over a 3D environment the panel won't show the assigned texture. I first noticed this in my project where I wanted to show the real-time render of a 2nd camera on the panel. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0]); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto font = LoadFont("Fonts/arial.ttf"); auto ui = CreateInterface(world, font, framebuffer->size); ui->background->SetColor(0, 0, 0, 0); //Create and position camera auto camera = CreateCamera(world); camera->SetPosition(0, 1, -2); int RENDERLAYER_1 = 2; auto ui_camera = CreateCamera(world, UltraEngine::PROJECTION_ORTHOGRAPHIC); ui_camera->SetRenderLayers(RENDERLAYER_1); ui_camera->SetPosition(framebuffer->size.x / 2.0f, framebuffer->size.y / 2.0f); ui_camera->SetClearMode(UltraEngine::CLEAR_DEPTH); auto panel = CreatePanel(0, 0, 512, 512, ui->root); auto tex = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/river_small_rocks_diff_4k.dds"); panel->SetTexture(tex); auto box = CreateBox(world); box->SetColor(1, 0, 0); while (true) { while (UltraEngine::PeekEvent()) { auto event = UltraEngine::WaitEvent(); switch (event.id) { case UltraEngine::EVENT_WINDOWCLOSE: if (event.source == window) { return 0; } break; } ui->ProcessEvent(event); } world->Update(); world->Render(framebuffer); } return 0; } Quote Link to comment Share on other sites More sharing options...
Solution SpiderPig Posted November 24, 2023 Author Solution Share Posted November 24, 2023 I fixed it auto ui = CreateInterface(world, font, framebuffer->size); ui->background->SetColor(0, 0, 0, 0); ui->SetRenderLayers(RENDERLAYER_1);//<----- Needs this!! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.