Mouse functions broken on 3D Windows on 4K Display

Post bugreports for the Windows version here
AndreasG
New User
New User
Posts: 1
Joined: Thu Jul 25, 2019 12:51 am

Mouse functions broken on 3D Windows on 4K Display

Post by AndreasG »

Hello PB Team,

there is a issue with the MouseDeltaX, MouseDeltaY Functions on 4k Screens when Screen3D is used windowed.

No matter if the mouse is moved up or down ( or left or right) only positive values are returned by the MouseDelta Functions.

When i start the Programm Fullscreen instead of Windowed positive and negative values are returned.
When i change the display resolution of my laptop to 1920*1080 and then start the PB Programm Windowed positive and negative values are returned.
When i change back the display resolution of the laptop to 4K only positive values are returned.

Best regards,

Andreas
coco2
Enthusiast
Enthusiast
Posts: 254
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Mouse functions broken on 3D Windows on 4K Display

Post by coco2 »

I had this problem intermittently (it would come and go) with my 4K monitor only while using openGL as the subsystem. I don't have the problem when using DirectX. I had another problem with openGL too, the frame rate sat at about 20 instead of 60.
EDIT: I do occassionally get the problem intermittently but I don't think it related to OpenGL, I had some wrong code earlier. The problem does happen occasionally and I have to restart PB to fix it.
Last edited by coco2 on Wed Jan 22, 2020 12:23 pm, edited 1 time in total.
User avatar
DK_PETER
Addict
Addict
Posts: 871
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: Mouse functions broken on 3D Windows on 4K Display

Post by DK_PETER »

Confirmed...But it is not only related to 4k resolution.
The problem arises when you add the latest windows updates from Microsoft.
For some reason MouseDelta goes haywire. The erratic behaviour
of (at times) large positive values only, is present in All windows versions, which
is able to download and apply the latest updates.
Before these updates, MouseDelta behaves as it should.
Tested and observed on Windows 8.1, Windows 10 home and Pro with latest updates applied.

Edit: Examples to try..Switch between FullScreen/Windowed

Edit 2: Just tried with PureBasic 5.62 on the same windows versions as above - same results.
Compiled versions (2D/3D examples) has been tested on 14 windows installed computer.
Only 5, which was without updates reported normal values from MouseDelta.

Examples to try:
CameraFollow.pb
MousePick.pb
Entity.pb
e.t.c...
2d code:

Code: Select all

InitSprite()
InitKeyboard()
InitMouse()

ExamineDesktops()
Global w = DesktopWidth(0)
Global h = DesktopHeight(0)
Global s.i

Procedure.i InitFullScreen()
  OpenScreen(w, h, 32, "FS")
  s = CreateSprite(#PB_Any, 50, 50)
  StartDrawing(SpriteOutput(s))
  Box(0, 0, OutputWidth(), OutputHeight(), $36EE3F)
  StopDrawing()
  Repeat
    ClearScreen(0)
    ExamineMouse()
    DisplaySprite(s, MouseDeltaX() + (ScreenWidth()/2 - 25), MouseDeltaY() + (ScreenHeight()/2 -25))
    FlipBuffers()
    ExamineKeyboard()
    
  Until KeyboardReleased(#PB_Key_Escape)
EndProcedure

Procedure.i InitWindowed()
  OpenWindow(0, 0, 0, w, h, "Windowed", #PB_Window_ScreenCentered)
  OpenWindowedScreen(WindowID(0), 0, 0, w, h)
  s = CreateSprite(#PB_Any, 50, 50)
  StartDrawing(SpriteOutput(s))
  Box(0, 0, OutputWidth(), OutputHeight(), $36EE3F)
  StopDrawing()
  Repeat
    ClearScreen(0)
    Repeat
      ev = WindowEvent() 
    Until ev = 0
    ExamineMouse()
    DisplaySprite(s, MouseDeltaX() + (ScreenWidth()/2 - 25), MouseDeltaY() + (ScreenHeight()/2 -25))
    FlipBuffers()
    ExamineKeyboard()
  Until KeyboardReleased(#PB_Key_Escape)   
EndProcedure
;InitFullScreen()
InitWindowed()
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations:
Windows 10, Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Windows 10, Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
DK_PETER
Addict
Addict
Posts: 871
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

(Solved for me...) Mouse functions broken on 3D

Post by DK_PETER »

It was a dpi-awareness problem. DPI must be checked in compiler settings -
then the problem disappears.

@Fred
I really don't think, that you can do anything about this.
The problem is not persistent. Sometime it works and sometime it don't. :?
If you suddently got the erratic behaviour and compile it,
the problem continues in the compiled software..
Right now, I get correct values from CameraFollow.pb
and Entity.pb behaves erratic..
Yesterday, none of the two examples worked properly.
Now compiling/running the CameraFollow.pb results in correct behaviour
while Entity.pb is wrong.. I guess that this will probably
suddently change... :lol:
Best regards

I now know that it is IDE related (Combined with Windows updates).
Here's an animated gif displaying the issue:

Image
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations:
Windows 10, Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Windows 10, Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
Post Reply