sonoro1234 / LuaJIT-ImGui

LuaJIT ffi binding for imgui, backends and extension widgets
MIT License
213 stars 29 forks source link

sdlrenderer #33

Closed jeffbdavenport closed 1 year ago

jeffbdavenport commented 1 year ago

If I use the following lines of code on Windows 10,

  ImGui_ImplSDL2_InitForSDLRenderer(&window, &renderer);
  ImGui_ImplSDL2_NewFrame();
  igNewFrame();

I just get the error below. What gives?

Assertion failed!

Expression: g.IO.Fonts->IsBuild() && 'Font Atlas not built!
Make sure you called ImGui_ImplXXXX_NewFrame() function
for renderer backend, which shiuld call
io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()`
sonoro1234 commented 1 year ago

Running which example?

I guess you are not running the provided examples because of the assertion. In this case it is more an imgui issue than a cimgui issue. But reading the assertion message I would say you are missing ImGui_ImplOpenGL3_NewFrame() being called

jeffbdavenport commented 1 year ago

I want to use the SDL renderer instead of OpenGL. Reading the implementation code it seems that it is possible. I am not running the example for that one because it doesn't seem to exist.

So OpenGL is required for the SDL2 implementation here? How would I go about trying to use the SDL2 renderer here instead?

sonoro1234 commented 1 year ago

So OpenGL is required for the SDL2 implementation here?

Yes, equivalent to https://github.com/ocornut/imgui/tree/master/examples/example_sdl2_opengl3

How would I go about trying to use the SDL2 renderer here instead?

You should be familiar first with which is provided. Then you should tune cimgui to generate C interface for https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_sdlrenderer.h. Then modify this repo to add sdlrenderer.

jeffbdavenport commented 1 year ago

Hmm alright