GTK3 + OpenGL for windows: multiple GtkGLArea (ie. OpenGL contexts) - windows

I am developing a GTK3 based application with OpenGL windows created using the GtkGLArea widget, to build the application on windows I use the msys2 64 bits system.
No problem to build the application, it works just with a single OpenGL window.
However my program is designed to handle multiple projects, and hence GtkGLarea, one for each project. This works perfectly for Linux.
However on window, it works with one GtkGLArea, but as soon as more than one are used only a single one (the first to be created) remains active, and no information is displayed in the other windows. If I click on any of the other windows then the content of the first window is updated with what should appear in the window I am interacting with ...
I noticed that I could open as many instances of my program each with one GtkGLAera working just fine, and therefore that the number of OpenGL context is not a problem, only the interaction / dialog / management within the same occurrence of my program is.
Is there any way to correct this behavior and how ?

Looks like it's a known GDK Win32 bug that has been fixed.
Bugzilla bug #789213

You should use wglMakeCurrent() analog to set current context, and after usage you should call wglMakeCurrent(NULL, NULL) to release context so the other widget will be able to use OpenGL.

Related

How to hide terminal shell on server application like Warp in Windows?

I have a small warp server project on Windows that listen to a particular port and do something whenever I send a command to it by REST (for example: POST http://10.10.10.1:5000/print). It's a small client for printing PDF / receipt directly from another computer.
It works. But my problem is when I had to package the whole project, the Rust compiler give me an executable file (.exe). The application displays a terminal window when I run it. I want this terminal to be hidden somehow.
I try to run the program as a windows service (by using NSSM). It doesn't work for me since I had to access the printer. Windows doesn't allow my app to access any devices or any other executable as a windows service. (The reasons are explained here: How can I run an EXE program from a Windows Service using C#?)
So I plan to run my app as a tray-icon application so user can control or close the app. (https://github.com/olback/tray-item-rs)
Unfortunately, I still cannot hide the app's terminal window.
Another solution that I found is hstart (https://www.ntwind.com/software/hstart.html). But I would like to use this as "the last resort" solution since many antivirus/windows defender mark it as a malware.
Do anyone know how to hide or get rid of it ?
After lot of searching, It turns out to be easier than I thought. Just add
#![windows_subsystem = "windows"]
on top of your main.rs file. (for rust > 1.18) and the terminal is gone.
These control the /SUBSYSTEM flag in the linker. For now, only
"console" and "windows" are supported.
When is this useful? In the simplest terms, if you're developing a
graphical application, and do not specify "windows", a console window
would flash up upon your application's start. With this flag, it
won't.
https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute
https://blog.rust-lang.org/2017/06/08/Rust-1.18.html
https://learn.microsoft.com/en-us/cpp/build/reference/subsystem-specify-subsystem?view=msvc-170

opengl viewport in Mac with FMX delphi

I have designed an application in Delphi FMX that uses a new component based on class TPresentedControl. This component presents the output of opengl functions. (something like drawing in a viewport with opengl).
In Windows application runs successfully, but in MacOS it runs without this opengl viewport.
You can see a relative discussion here: https://forums.embarcadero.com/thread.jspa?threadID=248299
Do I have to use NSOpenGLView instead of my component?
If not what other options do i have?
For whoever is interested,
in GitHub (https://github.com/tothpaul/Firemonkey/tree/master/GLPanel) a developer named Friedrich Westermann
opened a new pull request for Pauls Toth' code in which he wrote a new part with code for Mac and also some changes to the existed.
I have tested it and works perfectly on Mac.

SStab not appearing correctly in different OS's

I'm working on a legacy VB6 application in Windows 10. I'm currently trying to get the application to run seamlessly in Windows 10 and I'm coming across some issues. One of them is the SSTab control. See Image below:
Style, Tab Orientation, All the properties are identical, but as can be seen the text in Windows 7 looks proper vs Win 10. It seems to float left and when selected, one of the S's seems to get cut off the top and added in the 2nd line.
Anyone have any idea?
Try choosing Win 7 in the version part of compatibility. There is the App Compat Kit from MS that allows you to set thousands of compat settings rather than just a few common ones in that compatibility dialog https://www.microsoft.com/en-au/download/details.aspx?id=7352

Qt problems on Windows xp

I have written an Qt application.
On Windows 7 x64/x32 app work's fine.
On Windows XP in qDebug() there are lots of messages.
QPixmap it is unsafe to use pixmap outside the GUI thread
After that the app crashes with sigfault
but:
1) I dont use QPixmap in my code at all
2) I have only one created thread for creating some type of file(but this error occurs just after a couple of seconds after start of app).
3) I use QIcon(May be it uses QPixmap) in reinplecated QStyledItemDelegate(but there is no external threads...only slots and signals for reporting state e.c.t.)
4)I have reimplemented QAbstractListModel to process my QStyledItemDelegate's
5)On form created with Qt designer there is a toolBar with Iconed actions
Qt version 4.8.1
I couldn't even imagine where I'm not right...
Does any one have any suggestions?
Solved by myself
in QMainWindow reimplementation i have QTimer for updating 2 QLabels
That was the error beacuse as i figured out QTimer creates a thread for each timout() signal
Solution i have decided to be best for me is to reimplement Item class with signal dataChanged which is sent ot slot OnItemDataChanged in reimplementation of QAbstractItemModel
The message is displayed by a function named qt_pixmap_thread_test() in src/gui/image/qpixmap.cpp.
Link to the debug Qt libraries (you may need to build them) and set a breakpoint where that warning is displayed. At least you'll be able to see what the thread situation is at that point.
Also, for the benefit of anyone else who might run into this problem and is trying to search on the error, the exact error message is:
QPixmap: It is not safe to use pixmaps outside the GUI thread

Using Qt in a pre-existing x-platform project?

I have an existing cross platform project that runs on Mac, Linux and Windows.
Now, I want to add a 'native' UI to it - the ability to show some popup windows (to request user credentials) and perhaps FileOpen dialogs. By native I mean I want to use the systems build in file-open dialog - so on the Mac the mac file finder is shown and on Windows the shells file open window is shown.
Qt seems a good fit - its samples show that it can show the correct dialog on all platforms.
However, all the available Qt samples start at the very base level - assuming the entire project is developed in Qt. Is it possible to initialize and use Qt in a more ad-hoc fashion :- i want to keep all my Qt UI code in a seperate dll/dylib/so file with some simple exports (think ShowLoginPopup).
I think that the easiest approach would be to do it the other way around - having the Qt GUI drive the rest of the application. Qt is event based and does rely on its event loop, so you need to keep that running.

Resources