Re: [osg-users] Windows 8.1 DPI-aware scaling: Problem and solution

2016-05-17 Thread Björn Blissing
Hi Paul,

Regarding the error when you are trying to run the script: I suspect that you 
have another name for your build target then TARGET_TARGETNAME. This is only a 
variable name that I use for my build target names. Yours is probably something 
completely different. Check your what the first variable in ADD_EXECUTABLE or 
ADD_LIBRARY in your CMake script and use that variable instead of 
TARGET_TARGETNAME.

Regarding your second question: The script is complete, when you are amending 
manifests to DLL files you need to change the characters #1 to #2 in the 
script. 

I have updated my gist comment to reflect this:
https://gist.github.com/bjornblissing/6fc452fe7ec1fdfe3419#gistcomment-1317136

Hope that solves your issues.

Regards
Björn

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67132#67132





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Windows 8.1 DPI-aware scaling: Problem and solution

2016-05-17 Thread Paul McIntosh
Hi Björn,

Thanks for the info but sorry I am having trouble getting this to work (CMake 
3.4.0)...


Code:
CMake Error at CMakeLists.txt:1353 (ADD_CUSTOM_COMMAND):
  add_custom_command Wrong syntax.  A TARGET or OUTPUT must be specified.



I copied dpiawarescaleing.manifest and CMakeMainifest.txt to the OSG based dir 
and appended it to CMakeLists.txt

cat CMakeMainifest.txt >> CMakeLists.txt


> If you are amending manifests to DLL-files you will need to change the #1 to 
> #2 in the CMAKE example above. 


I only see #1 is the code incomplete?

Cheers,

Paul[/code]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67126#67126





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Windows 8.1 DPI-aware scaling: Problem and solution

2014-10-10 Thread Björn Blissing
Hi,

The Problem:
Today I tried to run our software on a computer running Windows 8.1. And for 
some reason my application window became too large for the screen, even though 
I explicitly set the window resolution to be the same size as the display 
resolution.

Why the problem happens:
This computer was connected to a screen with FullHD resolution and as a result 
the DPI-scaling was automatically configured to 150% by the operating system.  
Since Windows 8.1, the operating system will scale your application to this 
DPI-scaling setting, unless you explicitly declare the application as 
DPI-aware. Declaring your application as DPI-aware tells the operating 
system that you will be handling the scaling yourself.

The solution:
To make your application DPI-aware you must include a manifest with your DLL or 
EXE. The manifest file should look something like this:

?xml version=1.0 encoding=UTF-8 standalone=yes?
assembly xmlns=urn:schemas-microsoft-com:asm.v1 manifestVersion=1.0
  application xmlns=urn:schemas-microsoft-com:asm.v3
windowsSettings
  dpiAware 
xmlns=http://schemas.microsoft.com/SMI/2005/WindowsSettings;True/dpiAware
/windowsSettings
  /application
/assembly

This manifest can be included to your EXE or DLL file by using the mt.exe 
(manifest tool), which is shipped with Visual Studio.

This process can be automated via CMake using the following custom command to 
amend the DPI-aware manifest to the standard manifest:

# Amend manifest to tell Windows that the application is DPI aware (needed for 
Windows 8.1 and up)
IF (MSVC)
ADD_CUSTOM_COMMAND(
TARGET ${TARGET_TARGETNAME}
POST_BUILD
COMMAND mt.exe -manifest 
\${CMAKE_CURRENT_SOURCE_DIR}\\dpiaware.manifest\ 
-inputresource:\$TARGET_FILE:${TARGET_TARGETNAME}\\;\#1 
-outputresource:\$TARGET_FILE:${TARGET_TARGETNAME}\\;\#1
COMMENT Adding DPI-aware manifest...
)
ENDIF(MSVC)

If you are amending manifests to DLL-files you will need to change the #1 to #2 
in the CMAKE example above.

Hope this information will help others with the same problem.

Best regards

Björn

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org