Search the Community
Showing results for tags 'render'.
-
Look at 123 line loadingWorld->Render(framebuffer); I was doing similar thing to show loading screen when main menu was loading #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; shared_ptr<World> gameWorld; shared_ptr<Interface> gameUi; shared_ptr<World> loadingWorld; shared_ptr<Interface> loadingUi; shared_ptr<Camera> loadingCamera; shared_ptr<Camera> uiCamera; shared_ptr<Map> gameScene; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<Widget> menuPanel; bool isMenuOn = false; bool isMainMenuOn = true; bool resumeGameButtonCallback(const Event& ev, shared_ptr<Object> extra) { menuPanel->SetHidden(true); isMenuOn = false; return true; } bool mainMenuButtonCallback(const Event& ev, shared_ptr<Object> extra) { isMainMenuOn = true; return true; } bool newGameButtonCallback(const Event& ev, shared_ptr<Object> extra) { isMainMenuOn = false; return true; } bool exitButtonCallback(const Event& ev, shared_ptr<Object> extra) { exit(0); return true; } void guiInit() { // Load a font auto font = LoadFont("Fonts/arial.ttf"); // Create user interface gameUi = CreateInterface(gameWorld, font, framebuffer->GetSize()); gameUi->SetRenderLayers(2); gameUi->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); // Create ui camera uiCamera = CreateCamera(gameWorld, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition(float(framebuffer->GetSize().x) * 0.5f, float(framebuffer->GetSize().y) * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); int menuWidth = 200; int menuHeight = 200; int indent = 25; menuPanel = CreatePanel(framebuffer->size.x * 0.5 - menuWidth / 2, framebuffer->size.y * 0.5 - menuHeight / 2, menuWidth, menuHeight, gameUi->root); menuPanel->SetColor(0.2, 0.2, 0.2, 1); menuPanel->SetLayout(1, 1, 1, 1); menuPanel->SetHidden(true); int buttonWidth = menuWidth - indent * 2; int buttonHeight = 50; int posIter = 0; int buttonY = indent + posIter * (buttonHeight + indent); auto resumeButton = CreateButton("Resume", indent, buttonY, buttonWidth, buttonHeight, menuPanel); ListenEvent(EVENT_WIDGETACTION, resumeButton, resumeGameButtonCallback); posIter = posIter + 1; buttonY = indent + posIter * (buttonHeight + indent); auto mainMenuButton = CreateButton("Main Menu", indent, buttonY, buttonWidth, buttonHeight, menuPanel); ListenEvent(EVENT_WIDGETACTION, mainMenuButton, mainMenuButtonCallback); } int main(int argc, const char* argv[]) { RegisterComponents(); //Load FreeImage plugin (optional) auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Load a font auto font = LoadFont("Fonts/arial.ttf"); // LOADING loadingWorld = CreateWorld(); loadingUi = CreateInterface(loadingWorld, font, framebuffer->GetSize()); loadingUi->SetRenderLayers(2); loadingUi->root->SetColor(0.5f, 0.5f, 0.5f, 1.0f); float labelHeight = float(framebuffer->GetSize().y) * 0.2f; int centerX = float(framebuffer->GetSize().x) * 0.5f; int centerY = float(framebuffer->GetSize().y) * 0.5f; auto loadingLabel = CreateLabel("LOADING...", float(framebuffer->GetSize().x) * 0.05f, centerY - labelHeight * 0.5f, float(framebuffer->GetSize().x) * 0.95f, labelHeight, loadingUi->root, LABEL_CENTER | LABEL_MIDDLE); float fonstScale = labelHeight / 14.0f; loadingLabel->SetFontScale(fonstScale * 0.5f); loadingCamera = CreateCamera(loadingWorld, PROJECTION_ORTHOGRAPHIC); loadingCamera->SetPosition(float(framebuffer->GetSize().x) * 0.5f, float(framebuffer->GetSize().y) * 0.5f, 0); loadingCamera->SetRenderLayers(2); loadingCamera->SetClearMode(CLEAR_DEPTH); //CAUSES AN ISSUE loadingWorld->Render(framebuffer); //Create user interface auto ui = CreateInterface(world, font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.2f, 0.2f, 0.2f, 1.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); auto newGameButton = CreateButton("New game", 200, 125, 200, 50, ui->root); ListenEvent(EVENT_WIDGETACTION, newGameButton, newGameButtonCallback); auto exitButton = CreateButton("Exit", 200, 200, 200, 50, ui->root); ListenEvent(EVENT_WIDGETACTION, exitButton, exitButtonCallback); gameWorld = CreateWorld(); gameWorld->RecordStats(); WString mapName = "Maps/start.ultra"; gameScene = LoadMap(gameWorld, mapName); guiInit(); shared_ptr<World> currentWorld = world; shared_ptr<Interface> currentUI = ui; while (window->Closed() == false) { if (isMainMenuOn) currentWorld = world; else currentWorld = gameWorld; if (isMainMenuOn) currentUI = ui; else currentUI = gameUi; if (window->KeyDown(KEY_ESCAPE) == true) { menuPanel->SetHidden(false); isMenuOn = true; window->SetMousePosition(framebuffer->size.x * 0.5, framebuffer->size.y * 0.5); } while (PeekEvent()) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: if (ev.source == window) { exit(0); break; } break; case EVENT_STARTRENDERER: if (ev.data == 0) { Print("Error: Renderer failed to initialize."); Notify("Renderer failed to initialize.", "Error", true); return 0; } break; default: currentUI->ProcessEvent(ev); break; } } currentWorld->Update(); currentWorld->Render(framebuffer); } return 0; }
-
Default start map from template Happens after first enter press: Comment in loop "world = CreateWorld();" to get another render crash (RecordDraw) but it's not consistent and may take several attempts (Andy have this issue i believe): #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { RegisterComponents(); auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); WString mapname = "Maps/start.ultra"; auto scene = LoadMap(world, mapname); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyDown(KEY_ENTER)) { world = CreateWorld(); scene = LoadMap(world, mapname); } world->Update(); world->Render(framebuffer); } return 0; }
-
Hello Basically I want to draw have an image in the scene behind everything, but I need to have wireframe enabled. So I cant just place a face with a texture and put it behind. The skybox is also rendered in wireframe mode. So I need to have an Image Drawn before everything renders but this is impossible because I believe every pixel has a color value to it which renders over the drawn image. I also saw a thread (I think in c++) before about a similar problem from about 2014, and it said that there could be a feature for this implemented soon. So is there a feature for this ? Or a workaround ? In this photoshopped picture you can see that Leadwerks is visible but behind everything.
-
So they released an update for the amd graphics bug. But I loaded up my leadwerks and updated my project but it is stll happening. Am I missing something? please help
-
I'm trying to get a 3D character to display on top of the screen as part of the HUD (so unaffected by anything in the scene as if it's it's own scene). How could I achieve this effect?