Imgui: How draw on main window?

Created on 11 Feb 2019  路  5Comments  路  Source: ocornut/imgui

library is great. I compiling it on mac os x
sdl2 and Opengl

How I can draw directly on main window, for example line.
Where i must put this to example sdl opengl
?
(i undestand the gui will draw on my draw in main window, but gui windows are movable)

        glLineWidth(20);
        glColor3f(0.80, 0.0, 1.0);

        glBegin(GL_LINES);
         glVertex2f(50, 80);
         glVertex2f(20, 20);
        glEnd();

        glLineWidth(12);
        glColor3f(1, 0.0, 0.0);
        glBegin(GL_LINES);
        glVertex2i(10,10);
        glVertex2i(200,320);
        glEnd();

Most helpful comment

Sorry this is an OpenGL question, not a dear imgui question.

All 5 comments

ImGui has API to do drawing, see the demo window -> Examples -> Custom rendering.
image

Codes:
https://github.com/ocornut/imgui/blob/169e3981fdf037b179f1c7296548892ba7837dae/imgui_demo.cpp#L3871-L3978

This draw on gui image not on main window
not background

bottom all gui windows, i found in example directory
https://github.com/ocornut/imgui/blob/169e3981fdf037b179f1c7296548892ba7837dae/examples/example_sdl_opengl3/main.cpp

       glViewport(0, 0, display_w, display_h);
        glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
        glClear(GL_COLOR_BUFFER_BIT);

yes, using opengl directly. meybe imgui change some context? diff sample code will be help
I put my code but not working, anybody can help?

Meybe normal SDL_ function working?
But where is SDL_Surface?

Sorry this is an OpenGL question, not a dear imgui question.

imgui not have any way to draw on canvas=main window?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ILoveImgui picture ILoveImgui  路  3Comments

mkanakis picture mkanakis  路  3Comments

ghost picture ghost  路  3Comments

namuda picture namuda  路  3Comments

BlackWatersInc picture BlackWatersInc  路  3Comments