How to set app to always `open in low resolution` - c++

I have an application developed with Qt3D (which uses OpenGL) by Qt 5.11.3 and Xcode 9.4.1 build tools. App runs fine on Linux and Windows, but on macOS Retina display (10.14, Mojave), I observe:
There are two workarounds for the above observation:
Set Retina display to full native resolution (microscopically small) then open app which seems to look and function correctly. Then lower the resolution to something usable and app continues to work properly
Get info of the app and check the open in low resolution checkbox like this image from a website:
I have studied similar questions but the posted solutions look more like a hack. And my app is a complex one, I cannot just simply multiply everything by a ratio. Is there any other solution for this? How can I force my app to open in low resolution on macOS, already asked here? Thanks.

Related

Displaying a SDL window in Qt

Looking around at some SDL games and emulators I notice that each time there's an android version of it, same base code is used as the desktop versions.
For example in an atari 7800 emulator I've found on github, I don't really understand java and I'm trying to see how it's done there. I suppose that based on the line 991 it captures the display from the sdl2 process maybe by running it headless and rendering the sdlwindow in android?
No idea, trying to understand the code but I'm like looking at it like a cat looking at a calendar (a saying in my country).
What I'm trying to do is to somehow archive the same thing in QT5 since the platform I'm using uses it for the interface and anything app related to communicate with their APIs.

DirectShow fails with black frames and 0x80070005 on Win7/Win10

I'm developing a small video capture library on top of videoInput (a thin wrapper around DirectShow) and lately I encountered a tricky issue.
The library captures and saves video frames to its internal format, using code to the effect of this:
if (VI->setupDevice(m_deviceIndex, width, height)) {
//... checks for frame size etc
//...
auto pixels = VI->getPixels(m_deviceIndex, true, true);
}
This code was built in VS 2017 using vc140/sdk8.1 and it worked fine on a range of different machines running Windows 7, 8.1 and 10, which included typical office desktops and laptops, several development machines, a highly restrictive production desktop and VirtualBox guests.
Then we discovered that on one Windows 7 computer videoInput yields black frames (null pixels), even though the camera itself works properly with other applications. We tested several different camera models to the same effect.
I built DirectShow examples from official Microsoft repository and discovered that on startup the samples fail with hr=0x80070005 error (access denied), regardless of running in elevated mode. Here's where the error occurs (amcap.cpp, line 787).
Since official samples supposedly should work out of the box, I suspected that there might be a compatibility bug in later versions of SDK/MSVC and tried compiling with VS 2010, but that didn't help. I also tried different capture back-ends, using Windows Media Foundation example from the same repository, as well as OpenCV with ffmpeg - all to the same effect.
Then we discovered another machine, running Windows 10, which had exactly the same problem, indicating that this is not an issue of backwards compatibility. Meanwhile, the same builds were working fine on my test machines, and third-party applications like Webcamoid were working fine on the problematic PCs.
My best guess is that there's some kind of compatibility flag or permission which has to be granted, since the camera works just fine with third-party software, but I have no idea where to look for them, and Windows 7 doesn't have camera permission settings to begin with, if I'm not mistaken.
Now, does anyone have any idea what on Earth might be wrong? I would greatly appreciate any advice.
Thank's.
Problem solved.
The problem turned out to be due to Kaspersky Endpoint Security, which has an option to restrict video streaming for unknown applications. This is why camera apps from the Store worked fine (they were trusted by default), and our application didn't.
Caveat emptor.

How to start Xcode4 opengl project for mac

Good Day
I want to start a opengl project, mainly to follow the Nehe tutorials.
My problem is that I only see templates for opengl es for iphone, and when I click build on those, I only have the choice between iphone or ipad simulator.
So How can I get started with a simple opengl template to follow the tutorial series, without using a simulator, but executing it natively on my mac osx lion?
Please give me a step by step instruction if possible :)
I looked around everywhere but all I found were instructions for Xcode 3 and below etc.
Any help would be appreciated
Create a normal Cocoa project, add the OpenGL framework. In your main window add a NSOpenGLView.
http://developer.apple.com/devcenter/mac/resources/opengl/
I am currently in the process of writing an intuitive Xcode 4 Template for an OpenGL Mac application, which I think is exactly what you were wanting.
In the mean time, you can look at this, a Pong clone I made in OpenGL on the Mac, done the proper way.
EDIT: The template isn't completely finished, but it's definately usable. I didn't implemenet the 3D option, so picking that in the dropdown will result in blank files.
Donwload it from here and then move it into the ~/Library/Developer/Xcode/Templates/Project Templates/Applications folder in your user director.

How can I code my own custom splash screen for Linux?

This is NOT a question on plain old boring customization; I actually want to create an program, you know, with source code, etc...
I'm thinking about programming my own media centre interface, and I figured it'd look better if I coded my own splash screen for when the OS is loading.
Note: The media centre interface will be run in X, but this question is regarding what will happen before the X server loads.
Simply, I'd like to make a splash screen application to hide the linux kernel boot messages. Is there a way I can program some animation in to this like some sort of animated progress bar for example? I assume that I won't be able to code any 2D/3D graphics (as that'd require X to be running, right?), so how would I go about generating that?
I'd prefer to do this in C++, but C is also an option.
Note: I'm not looking to use any existing "themes" or anything like that, just interested in the programming side of things.
Update:
Some suggestions have been to use standard images (.bmp, .jpeg, etc), I am not interested in loading images in to an existing application. But obviously I may want to load images in to the boot screen application that I will make.
I'm not tied to a Linux distro, so this can be for anything, although Debian or a Debian-based distro would be nice.
I like the suggestion about loading the X server early and running a loading screen from there, however is there not a more direct approach? Surely you can make a program which hides the boot messages and shows a custom program? Obviously this would be very low level programming, but that's what I'm looking for...
Also, I'm not interested in altering the boot loader (LILO, GRUB, etc).
Update 2:
So far good suggestions have been looking at the source code for applications like splashy and fbsplash. Can anyone better this suggestion?
For the graphical output you can use the Linux framebuffer, for application development you can use gtk which support rendering directly to the framebuffer GtkFB.
For the video and such you can use mplayer which also support rendering to the framebuffer.
For the initialization you have to look around the system used, debian uses a sysv init style initialization http://www.debian-administration.org/articles/212, ubuntu uses upstart.
I'd look into splashy source code. But you will need to code in C.
If you have the skills, you can implement a software based 3D engine (like in the good old days). A simple rotating cube shouldn't be very hard to code and there are tons of tutorials.
The downside is that you will increase the boot time, something not very pleasant in a media center.
Here's the thing: there is a library/kernel patch, fbsplash, that has already been written to do exactly what it sounds like you want to do. It will display an image in place of the normal boot messages, and it can also incorporate a progress bar. When you're trying to do something for which a well-established open-source implementation already exists, there's really no better way to learn how to do it yourself than to look at the source code.
Even if you're looking for something more complicated (say if you want to create some fancier animation than a progress bar), you might be able to start with fbsplash and modify it to suit your needs.
There are several ways you could do this. You could have the X server load very early, and just write a program to display the splash screen. You could also use the framebuffer device. If you are using Intel hardware, or are willing to use the OSS AMD drivers, or Nouveau for Nvidia, you could use kernel mode setting. For this, I would look at Fedora's Plymouth. You could just write a Plymouth plugin to display your splash screen.
The splash screen is simply an image (.bmp, .jpg, etc.) and can be loaded by the boot loader. Since you haven't specified the distribution you're using, look into LILO, grub, or whichever one is appropriate. Check the /boot directory for clues that will direct your search.
If all you want to do is have a nice clean boot sequence with your own splash and absolutely no boot messaging you can do the following:
First, silence grub, boot messaging, and console cursor:
GRUB_CMDLINE_LINUX_DEFAULT = quiet fastboot splash vt.cur_default=1 loglevel=0
GRUB_TIMEOUT = 0
This will very quickly and silently (fade to black) bring you to your login screen, where you can place a splash. Your distro may show it's own splash briefly, which you can change if you like.
This yeilds a professional clean boot sequence, without all the usual linux warts and wrinkles. (Like OSX and Windows).
I personally use Ubunutu with LXDE, and have a clean splashy boot in under 3 seconds, even on older hardware.

Change Windows Mobile 6.1 Theme Programmatically

I am trying to figure out the proper procedure for applying a new tsk based theme file in windows mobile 6.1.
I have tried working off of the page http://www.pocketpcdn.com/articles/changetodaytheme.html But this only changes the background, not the system colors for things such as the top and bottom bars on the screen.
wceload.exe seems to work perfectly for some tsk's and partially for others.
Does anyone know more about tsk files and applying them programmatically in Windows Mobile 6.1?
My application is an open source application, the code is avail;able via read only svn, feel free to check it out # google code
I ended up finding a solution, I don't think it is a universal solution though.
Calling "\Windows\cusTSK.exe \Windows\ThemeName.tsk" changes the top and bottom bars, but does not change all apsects of the theme... so calling wceload.exe and then calling cuTSK.exe in that order seems to be able to change the theme using all tsk files that I have tested.
The cusTSK.exe binary does not exist on the Windows Mobile 6.1 Professional emulator image that you can download from msdn, so I think that this file that exists on custom roms and HTC made devices, that is why I do not think this is a universal solution, but it works for my purposes