Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Karma

Pages: [1]
1
Hello!

Lately I was implementing a SFML widget in Qt and experimenting with multithreading. I ran into a problem that causes SFML widget contents (ie. everything that's drawn on it) to wobble up and down when its height is being resized. The same doesn't happen when it's the width that is being changed.

What my code does is:

- create main window Qt widget,
- create SFML widget (doesn't do any polling, updating or drawing on its own, just deactivates the context upon initialization) on the main thread,
- create worker object on the main thread and pass it the SFML widget pointer,
- move worker to a separate thread and run its poll-update-draw loop.

Resizing happens on the main thread since the main window is passing the resized event to the SFML widget. I am using a sf::View to expand the viewport instead of resizing the contents. That's the code I use each time a sf::Event::Resized is polled. I tried doing this on the main thread and on the worker thread - no difference.

Code: [Select]
m_view->setSize(width, height);
m_view->setCenter(width / 2.0f, height / 2.0f);
m_canvas->setView(*m_view);

I discovered that if I move just the event polling and updates to a different thread and leave the drawing on the main thread the wobbling stops. I am trying to understand the reason of the wobbling but I'm not sure. Maybe it has to do with OpenGL having the coordinate system beginning in the bottom-left corner? What could be the reason and how could I prevent it while still having the drawing on a separate thread along with event polling and updates?

Minimal code spans across multiple files and requires Qt but I can upload it if needed. For the time being here's a video of what's happening. The wobbling starts when I change the height of the window in 0:24.

I am using stable SFML 2.1 from the main page and Qt 5.2.0. My operating system is Windows 7 Ultimate x64.



P.S. Event polling somehow works fine on a thread that doesn't own the SFML window, even though here it says it shouldn't. And it actually doesn't in a clean SFML application, so it's likely due to Qt.

2
General / Static linking produces a lot of undefined reference errors
« on: July 13, 2012, 03:13:17 pm »
Hello!

Just before posting I checked my MinGW one more time and spotted libgcc_s_dw2-1.dll file in MinGW/bin. After installing SFML 2.0 RC DW2 everything works fine. Seems like mingw-get downloads the Dwarf2 version, not the SJLJ one as I previously thought, so the reason was obviously compiler and library version discrepancy.

I am posting this nevertheless for people who might encounter similar problem in the future.

Original message below.



I have been using SFML 1.6 for quite some time already and after finishing my university project finally decided to transfer to SFML 2.0. I have downloaded the latest MinGW version through mingw-get, updated my Code::Blocks to the newest nightly (build 8086 at the time of writing) and also gave Eclipse CDT Juno (32-bit since the 64-bit version has some nasty bugs) another try as I have yet to settle for a single IDE. Also, I am using MinGW 4.6.2 under Windows 7 Ultimate x64 SP1.

At first I used dynamic library linking and everything went smooth, with the exception of both IDEs not being able to run the binary without the DLL files being in the same directory even though I have SFML's bin directory in my PATH system variable. Code::Blocks was kind enough to tell me about it not being able to find the DLL files, unlike Eclipse.

Static linking was next. Defined SFML_STATIC and set up library linking order as follows: sfml-graphics-s-d, sfml-window-s-d, sfml-system-s-d (since I am building debug in this case). And it just won't compile. Code::Blocks reports over 650 errors that you can see here: http://pastebin.com/rySV8n8b. And here is my test code: http://pastebin.com/Jbf7yAPX. Compiling through Eclipse gives more or less (circa 500 errors for some reason) the same effect.



I have read a lot concerning similar problems and what seemed to cause most of them was: using different versions of linker and compiler, using DW2 MinGW with SJLJ SFML or compiling SFML and applications using it with different versions of compiler. I am: using the same version of linker and compiler from MinGW package, both are SJLJ exception handling versions and I did not compile SFML 2.0 RC, I just downloaded it.

Would you please help me with this issue?




Thanks anyway!


Edit: As you wish, Laurent.

Pages: [1]
anything