Main Menu

Recent posts

#81
General Discussion / Re: Black area during resize
Last post by KSergeyP - 30 October 2024, 13:30:39
Quote from: texus on 25 October 2024, 09:14:22SDL recently worked around it by allowing you to bind a SDL_EVENT_WINDOW_EXPOSED callback that would get called during resize (and in which you can then render (see e.g. https://github.com/libsdl-org/SDL/issues/1059).

Yes, it works with SDL3
But it stretches with a bit of a slowdown, the black area is visible if you quickly drag it with the mouse, but then it is automatically filled and the layouts are automatically stretched
Perhaps you need to tweak something in the SDL settings for greater smoothness/speed of rendering
#82
General Discussion / Re: Black area during resize
Last post by texus - 25 October 2024, 09:14:22
It is a Windows-issue in the sense that it is a Windows call that hangs during resize. All window libraries will face issues with it, but a library like QT will have workarounds to make things work. In the SFML github issue they also mention some of the things that they can do to make it work in the future.

Other libraries have the same issue, e.g. GLFW's glfwPollEvents also hangs (e.g. https://stackoverflow.com/a/56614042 describes a method to redraw when the mouse is moved during resizing).
SDL recently worked around it by allowing you to bind a SDL_EVENT_WINDOW_EXPOSED callback that would get called during resize (and in which you can then render (see e.g. https://github.com/libsdl-org/SDL/issues/1059).

I have not experimented with any of these workarounds in combination with TGUI though. Although it should be the exact same as rendering otherwise: you call gui.draw() inbetween the locations where you are clearing and displaying the window contents.

As for which backend is the best. For most people either one will work, there are only minor differences. While I love SFML, it is the one that is the least feature-complete and lacks some advanced functionality, while SDL is commonly used in many places so it probably has the most options that can be tuned to get what you want.
#83
General Discussion / Re: Black area during resize
Last post by KSergeyP - 25 October 2024, 08:46:15
Quote from: texus on 25 October 2024, 08:36:34This is a known issue in SFML that is related to how resizing works on Windows. See e.g. https://github.com/SFML/SFML/issues/3016
They write that this is a Windows problem. But QT somehow solves this - by default it works on Windows without these problems.
#84
General Discussion / Re: Black area during resize
Last post by KSergeyP - 25 October 2024, 08:40:07
I'm using SFML Graphics (Windows). Tried SFML Windows - same thing
Which backend is best for Windows?
#85
General Discussion / Re: Black area during resize
Last post by texus - 25 October 2024, 08:36:34
I'm assuming you are using the SFML backend and are using Windows? (other backends might have a similar issue though)

This is a known issue in SFML that is related to how resizing works on Windows. See e.g. https://github.com/SFML/SFML/issues/3016
#86
General Discussion / Black area during resize
Last post by KSergeyP - 25 October 2024, 08:30:33
When I stretch the window with the mouse, a black area appears and the window is redrawn only when I release the mouse button.
Are there any simple examples with automatic image update when resizing?
#87
Feature requests / Re: Rounded borders for contai...
Last post by texus - 24 October 2024, 17:11:44
Unfortunately I don't know any way that I can render it better.

You should use a transparent image that contains the rounded borders and set that as the background texture of the panel. That way, you would get smooth borders due to the borders being anti-aliased when creating the image. You can use TGUI's 9-slice scaling to use the image with any container size (as long as the border thickness is the same).
#88
Feature requests / Re: Rounded borders for contai...
Last post by KSergeyP - 24 October 2024, 14:51:50
Quote from: texus on 15 November 2021, 22:44:21The setRoundedBorderRadius function has been added to PanelRenderer in TGUI 0.9 and 0.10-dev.
Is it possible to improve rendering accuracy when rounding?
By default it's rough - you can see rectangles
#89
Help requests / Re: tgui::CanvasOpenGl3 widget
Last post by texus - 12 October 2024, 22:08:31
The minimal information on how to use the canvas is located at https://tgui.eu/tutorials/latest-stable/canvas/#canvasopengl3

After you created the canvas and added it to the gui, you would have the following code to render to the canvas. The contents of the canvas is then later drawn to the window when you call gui.draw().
Code (cpp) Select
canvas->bindFramebuffer();  // Calls glBindFramebuffer with the id of the canvas framebuffer
glClear(GL_COLOR_BUFFER_BIT);
// OpenGL calls placed here will draw on the canvas
glBindFramebuffer(GL_FRAMEBUFFER, 0);

The purpose of the CanvasOpenGl3 widget is to render custom OpenGL stuff in the middle of TGUI widgets. It thus makes no sense to render TGUI widgets on the canvas.
#90
Help requests / tgui::CanvasOpenGl3 widget
Last post by naylinntu - 12 October 2024, 21:42:45
I am using TGUI compiled with GLFW, it works well for common widgets like buttons and message boxes.

How can I render an OpenGL scene on tgui::CanvasOpenGl3 widget?
My code looks like below::

`#include <gl/glew.h>

auto canvas = tgui::CanvasOpenGL3::create({200,200});
canvas->setPosition(300, 200);
gui.add(canvas); canvas->bindFramebuffer();
'

`auto canvas_size_button = tgui::Button::create("Get canvas size");
gui.add(canvas_size_button);
// few other widgets added here

while (!glfwWindowShouldClose(window)){
glUseProgram(shaderProgram);
gui.draw();
glDrawArrays(GL_LINES, 0, 2);
}`


I am using GLEW with this.
but it does not work. It only show other widgets placed into `gui` and they work well.

Appreciate if an example show how to render a simple triangle on Canvas along side with few simple widgets like buttons. or point to the correct way.
Thanks