Tuesday, July 12, 2022
HomeGame Developmentopengl - ImGui Rendering Textual content Atlas as an alternative of Framebuffer...

opengl – ImGui Rendering Textual content Atlas as an alternative of Framebuffer coloration texture


My utility appears like this:

Scene window showing font atlas

I’m utilizing Pricey ImGui for UI and want to draw the body buffer contents right into a texture after which show that texture in an ImGui Window.

I’ve adopted the official OpenGL information on easy methods to make a body buffer, and render it to a texture, and in addition easy methods to combine it with Pricey ImGui.

Nevertheless, as seen within the first picture, I am getting the default font atlas texture rendering as an alternative of my body buffer’s coloration texture. It doesn’t matter what I strive, whether or not I go it as a perform parameter

ui.Render(framebuffer.colourTexture);

or direct project

ui.colourTex = framebuffer.GetColourTexture();

So this received me interested by if my manner of making the picture view within the first place is improper (see beneath).

void UI::SceneView(unsigned int colorBuffer)
{
    ImGui::ShowDemoWindow();

    ImGui::Start("Scene");
    {
        ImGui::BeginChild("Renderer Viewport");

        ImGui::Textual content("Scene View");

    ImVec2 pos = ImGui::GetCursorScreenPos();
    ImVec2 windowSize = ImGui::GetWindowSize();

    ImGui::GetWindowDrawList()->AddImage(
            (void *)(intptr_t)colorBuffer, 
            ImVec2(pos), ImVec2(pos.x + windowSize.x, pos.y + windowSize.y), 
            ImVec2(-1, 0), ImVec2(0, 1));

        ImGui::EndChild();
        ImGui::Finish();
    }
}

This will look barely unusual contemplating there’s an ImGui::Picture() Class; nonetheless, this methodology offers higher low-level entry, excellent for an engine.

I additionally thought it might be the order I am drawing my scene in however my scene renders tremendous, simply with the improper texture within the viewport.

Anyway, I might be extraordinarily grateful if anybody may level me in the best route/may probably counsel a repair as a result of I’ve been caught on this for months and with research + a part-time job I actually haven’t got a lot time to work on my engine.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments