mikke89 / RmlUi

RmlUi - The HTML/CSS User Interface library evolved
https://mikke89.github.io/RmlUiDoc/
MIT License
2.77k stars 304 forks source link

The default GLFW GL3 backend yields weird display #618

Closed Dich0tomy closed 4 months ago

Dich0tomy commented 4 months ago

Hello. I am trying to use the default GLFW GL3 backend, but the window I'm getting doesn't seem to be updating properly, and it captures the background and then stays still:

image

Here's the repro: https://github.com/Dich0tomy/repro It has a flake which is buildable and runnable, but you can also just do

meson setup compile
meson compile -C build

I'm not sure what I'm doing wrong, especially since building your examples produces the desired output: image

Any help is appreciated.

mikke89 commented 4 months ago

Hey there.

Based on you main.cpp file, it looks like you're game loop is missing both event processing and frame setup / present. Compare it to the loaddocument sample:

https://github.com/mikke89/RmlUi/blob/c84ed5de7877c467ca43abd9095f8dedeb92255b/Samples/basic/loaddocument/src/main.cpp#L82-L97

Dich0tomy commented 4 months ago

Indubitably that works! Thanks a lot! </3 Stupid me for not reading the samples carefully enough, my bad.. While I'm here - the window is displayed in such a manner, that I can resize it and the rendered document doesn't resize with it:

  1. What if I wanted to make a window that doesn't resize
  2. What if I wanted to make a window that resizes but the document resizes with it?

Also, it seems that neither Ctrl+Shift+C (which is the default binding in awesomwm for closing windows, every window closes with it) nor Ctrl+Q close the window, is that also a non-default togglable setting?

If answer to these is somewhere in the docs, just say so, I'll find it later, but I am assuming it may be because of the fact I'm using a TWM, they typically tend to mess with windows a lot.

mikke89 commented 4 months ago

What we provide in terms of windowing is intentionally very basic. You should provide your own keyboard shortcuts and so on, to fit your needs. Our samples demonstrate some keyboard shortcuts, so be sure to check out the Shell and individual samples.

To allow resizing or not, you'll notice that there is a boolean in Backend::Initialize for that exact purpose. But more to the point, check the GLFW documentation for more detailed window controls, and change the backend to your needs.

Some of our samples are resizable, some are not. Some of the sample documents scale to the window when that changes size, others do not. This is controlled by the combination of window settings and RCSS. For example, use top/right/bottom/left RCSS properties to make a document scale relative to the window edges. The document is really just an absolutely positioned RML element, so just keep that in mind and make your layout rules accordingly.

Dich0tomy commented 4 months ago

Thanks a lot!