PureBasic Forum
https://www.purebasic.fr/english/

Mouse functions broken on 3D Windows on 4K Display
https://www.purebasic.fr/english/viewtopic.php?f=4&t=73259
Page 1 of 1

Author:  AndreasG [ Thu Jul 25, 2019 12:58 am ]
Post subject:  Mouse functions broken on 3D Windows on 4K Display

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

Author:  coco2 [ Thu Jan 02, 2020 12:14 pm ]
Post subject:  Re: Mouse functions broken on 3D Windows on 4K Display

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.

Author:  DK_PETER [ Wed Jan 15, 2020 12:56 am ]
Post subject:  Re: Mouse functions broken on 3D Windows on 4K Display

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:
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()

Author:  DK_PETER [ Tue Jan 21, 2020 2:26 pm ]
Post subject:  Re: Mouse functions broken on 3D Windows on 4K Display

@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

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/