[Solved] Question about the screen's pixel size Topic is solved

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

[Solved] Question about the screen's pixel size

Post by knn217 »

Hello, the displayed pixel size seems to be different for the debug and the release build of the tutorials:

debug build's config window and screen:
Image
Image

release build's config window and screen:
Image
Image

The release build have smaller screen for the app even when both have the same resolution setting: 1280 x 720
The config window for the release build also seems to have a sharper font for the texts.

Since the code for both builds are the same, I thought I needed to set it somewhere in one of the .cfg files but they both seems to have the same settings. How can I change the this? both builds for my project is the same as the tutorial's debug build, but I prefer the display sharpness in the tutorial's release build.

Last edited by knn217 on Fri Oct 13, 2023 9:45 am, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5476
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1358

Re: Question about the screen's pixel size

Post by dark_sylinc »

This looks like a weird bug, but it is the first time I see this.

knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

Re: Question about the screen's pixel size

Post by knn217 »

Sorry if there's not enough details on the bug, I couldn't get any info on the differences since one of them is on the release build.
Here's the ogre.cfg files in case they are useful. Also, this is on Windows, Visual Studio.

debug:

Code: Select all

Render System=Vulkan Rendering Subsystem

[Direct3D11 Rendering Subsystem]
Allow NVPerfHUD=No
Backbuffer Count=Auto
Driver type=Hardware
FSAA=1x MSAA
Fast Shader Build Hack=Yes
Floating-point mode=Fastest
Full Screen=Yes
Information Queue Exceptions Bottom Level=Info (exception on any message)
Max Requested Feature Levels=11.1
Min Requested Feature Levels=9.1
Rendering Device=(default)
VSync=No
VSync Interval=1
Vendor Extensions=Auto
Video Mode=1920 x 1080 @ 32-bit colour
sRGB Gamma Conversion=Yes

[OpenGL 3+ Rendering Subsystem]
Colour Depth=32
Display Frequency=120
FSAA=1
Full Screen=Yes
RTT Preferred Mode=FBO
VSync=No
VSync Interval=1
Video Mode=1024 x 768
sRGB Gamma Conversion=Yes

[Vulkan Rendering Subsystem]
Colour Depth=32
Device=NVIDIA GeForce RTX 3050 Laptop GPU #1
Display Frequency=N/A
FSAA=1
Full Screen=No
Interface=win32
VSync=No
VSync Interval=1
VSync Method=Render Ahead / FIFO
Video Mode=1280 x 720
sRGB Gamma Conversion=Yes

release:

Code: Select all

Render System=Vulkan Rendering Subsystem

[Direct3D11 Rendering Subsystem]
Allow NVPerfHUD=No
Backbuffer Count=Auto
Driver type=Hardware
FSAA=1x MSAA
Fast Shader Build Hack=Yes
Floating-point mode=Fastest
Full Screen=Yes
Information Queue Exceptions Bottom Level=No information queue exceptions
Max Requested Feature Levels=11.1
Min Requested Feature Levels=9.1
Rendering Device=(default)
VSync=No
VSync Interval=1
Vendor Extensions=Auto
Video Mode=1920 x 1080 @ 32-bit colour
sRGB Gamma Conversion=Yes

[OpenGL 3+ Rendering Subsystem]
Colour Depth=32
Display Frequency=120
FSAA=1
Full Screen=Yes
RTT Preferred Mode=FBO
VSync=No
VSync Interval=1
Video Mode=1024 x 768
sRGB Gamma Conversion=Yes

[Vulkan Rendering Subsystem]
Colour Depth=32
Device=NVIDIA GeForce RTX 3050 Laptop GPU #1
Display Frequency=N/A
FSAA=1
Full Screen=No
Interface=win32
VSync=No
VSync Interval=1
VSync Method=Render Ahead / FIFO
Video Mode=1280 x 720
sRGB Gamma Conversion=Yes
knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

Re: Question about the screen's pixel size

Post by knn217 »

dark_sylinc wrote: Fri Oct 13, 2023 4:47 am

This looks like a weird bug, but it is the first time I see this.

I just went through all the old tutorial projects I did to learn ogre-next, and some of them has the sharp display on the debug build and some doesn't.
Luckily these projects all have only one .cpp file so it's easy to copy the code from one project to another.

The results is that the ones that originally have sharp display still have that while the rest don't, even when they all have the same code.

When I debugged them, I saw that the differences is at mWindow's mLeft and mTop, they somehow got different values through different projects even with the same code.

Edit: Sorry for the confusion, the difference in mLeft and mTop is due to my old code calling setwindowpos, not from ogre's behavior. The code does calculate the new position for mTop and mLeft from GetMonitorInfo, which has differences. I'm now looking to see if different monitor results is caused by ogre or not.

Debugging the config window also show that GetSystemMetrics( SM_CXFULLSCREEN ) and GetSystemMetrics( SM_CYFULLSCREEN ) return different values for screen width and height between projects, which comes from monitor's info. This doesn't seem like Ogre's behavior since this line of code still give different values even after I've deleted everything else. Just did a few searches and it seems that many people find this function inconsistent.

knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

Re: Question about the screen's pixel size

Post by knn217 »

This is a Windows only problem, there are 2 solutions for Visual Studio users, found here: https://learn.microsoft.com/en-us/windo ... -a-process

The 1st solution (recommended):
_Open your project's properties => Configuration Properties => Manifest Tool => Input and Output => DPI Awareness =>set to "High DPI Aware"

The 2nd solution (not recommended):
_Add this line at the start of your program:

Code: Select all

	// This line needs to be called before any HWND has been created
	SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);