RaspPi - Mouse does not work with the 3D demos

Everything related to 3D programming
PeDe
Enthusiast
Enthusiast
Posts: 329
Joined: Sun Nov 26, 2017 3:13 pm

RaspPi - Mouse does not work with the 3D demos

Post by PeDe »

PB v6.30b5 arm64, Raspberry Pi OS (Trixie, Wayland), P500

The mouse does not work with the 3D demos. Only occasionally can you see that something moves briefly. I have tested various mice with cables, wireless, Bluetooth, but none of them work.

With a slower P400 and 32-bit OS, the mouse works a little better, but is still unusable.

Is this a bug in Ogre?

Peter
miso
Enthusiast
Enthusiast
Posts: 572
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: RaspPi - Mouse does not work with the 3D demos

Post by miso »

PeDe wrote: Thu Dec 11, 2025 4:34 pm PB v6.30b5 arm64, Raspberry Pi OS (Trixie, Wayland), P500

The mouse does not work with the 3D demos. Only occasionally can you see that something moves briefly. I have tested various mice with cables, wireless, Bluetooth, but none of them work.

With a slower P400 and 32-bit OS, the mouse works a little better, but is still unusable.

Is this a bug in Ogre?

Peter
Hello Peter!

I think the problem is not with the machine, but with that particular Linux distro you use.
( I dont know the answer though, just guessing)

I work with windows, and almost always with screens. My programs was running on Linux users machine with the same look and behavior... until now.
It is known to me, that the mouse handling (on windows at least) is bound to the OS events, those must be iterated trough with every loop, otherwise the mouse will start to fall behind ( because the event queue starts to flood )

So if you have problems, I think your Linux distro might handle things differently.
Can't be sure, as I'm not really familiar with it. What is that particular linux distro? Ah nevermind, Trixie, Wayland.

Any other person maybe with the same linux out there?
PeDe
Enthusiast
Enthusiast
Posts: 329
Joined: Sun Nov 26, 2017 3:13 pm

Re: RaspPi - Mouse does not work with the 3D demos

Post by PeDe »

This example outputs exactly 60 frames per second, and the mouse pointer works normally.
If the first line is used, the sprite is not displayed. There are also 60 frames, but the mouse pointer can no longer be moved properly.

Peter

Code: Select all

; Debug "InitEngine3D: " + InitEngine3D()
Debug "InitSprite: " + InitSprite()
Debug "InitMouse: " + InitMouse()
Debug "InitKeyboard: " + InitKeyboard()
OpenWindow(0,0,0,800,600,"",#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,800,600)
CreateSprite(0,128,128)
StartDrawing(SpriteOutput(0))
Circle(64,64,64,$ff)
StopDrawing()

start.q = ElapsedMilliseconds()
Repeat
  While WindowEvent():Wend
  ExamineMouse()
  ExamineKeyboard()
  ClearScreen(0)
  DisplaySprite(0,MouseX()-64,MouseY()-64)
  FlipBuffers()
  
  c + 1
  If (ElapsedMilliseconds() - start) >= 1000
    Debug "Frames: " + c + " - X: " + MouseX() + " Y: " + MouseY()
    start.q = ElapsedMilliseconds()
    c = 0
  EndIf
Until KeyboardPushed(#PB_Key_Escape) Or MouseButton(3)
miso
Enthusiast
Enthusiast
Posts: 572
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: RaspPi - Mouse does not work with the 3D demos

Post by miso »

PeDe wrote: Thu Dec 11, 2025 9:14 pm This example outputs exactly 60 frames per second, and the mouse pointer works normally.
If the first line is used, the sprite is not displayed. There are also 60 frames, but the mouse pointer can no longer be moved properly.

Peter
It works here on windows. Only the debugwindow (that appears on top of the windowed screen) causes some disturbance.
Could you try this with debugger off?

Code: Select all

; Debug "InitEngine3D: " + InitEngine3D()

InitSprite()
InitMouse()
InitKeyboard()
OpenWindow(0,0,0,800,600,"",#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,800,600)
CreateSprite(0,128,128)
StartDrawing(SpriteOutput(0))
Circle(64,64,64,$ff)
StopDrawing()

start.q = ElapsedMilliseconds()
Repeat
  While WindowEvent():Wend
  ExamineMouse()
  ExamineKeyboard()
  ClearScreen(0)
  DisplaySprite(0,MouseX()-64,MouseY()-64)
  FlipBuffers()
  
  Delay(1)
Until KeyboardPushed(#PB_Key_Escape) Or MouseButton(3)
User avatar
mk-soft
Always Here
Always Here
Posts: 6420
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: RaspPi - Mouse does not work with the 3D demos

Post by mk-soft »

It's probably a bug with the mouse. After ExamineMouse, call DesktopMouseX once.

Fix ...

Code: Select all

ExamineMouse()
DesktopMouseX()
Rendering no longer works with Debian 13 :(
Example BillboardGrass.pb
Last edited by mk-soft on Thu Dec 11, 2025 10:00 pm, edited 1 time in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
miso
Enthusiast
Enthusiast
Posts: 572
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: RaspPi - Mouse does not work with the 3D demos

Post by miso »

mk-soft wrote: Thu Dec 11, 2025 9:53 pm It's probably a bug with the mouse. After ExamineMouse, call DesktopMouseX once.

Fix ...

Code: Select all

ExamineMouse()
DesktopMouseX()
Rendering no longer works with Debian 13 :(
Thanks for the test and for the workaround fix. This should go to the bugreports then.
User avatar
mk-soft
Always Here
Always Here
Posts: 6420
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: RaspPi - Mouse does not work with the 3D demos

Post by mk-soft »

I hadn't updated my Raspberry with Debian 13 for a long time.
Rendering with BillboardGass.pb works again ;)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
minimy
Enthusiast
Enthusiast
Posts: 753
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: RaspPi - Mouse does not work with the 3D demos

Post by minimy »

The problem is this:
When you start initengine you need add a camera and use renderworld() before draw sprites.
No need this: ClearScreen(0), renderworld clear the screen.

This work:

Code: Select all

Debug "InitEngine3D: " + InitEngine3D()

InitSprite()
InitMouse()
InitKeyboard()
OpenWindow(0,0,0,800,600,"",#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,800,600)
CreateSprite(0,128,128)
StartDrawing(SpriteOutput(0))
Circle(64,64,64,$ff)
StopDrawing()

CreateCamera(0,0,0,100,100)


start.q = ElapsedMilliseconds()
Repeat
  While WindowEvent():Wend
  ExamineMouse()
  ExamineKeyboard()
  ;   ClearScreen(0) ;renderworld clean the screen
  RenderWorld()
  DisplaySprite(0,MouseX()-64,MouseY()-64)
  FlipBuffers()
  
  Delay(1)
Until KeyboardPushed(#PB_Key_Escape) Or MouseButton(3)
If translation=Error: reply="Sorry, Im Spanish": Endif
PeDe
Enthusiast
Enthusiast
Posts: 329
Joined: Sun Nov 26, 2017 3:13 pm

Re: RaspPi - Mouse does not work with the 3D demos

Post by PeDe »

I don't see the sprite with InitEngine3D() in any of the examples.
The mouse pointer works with the tip from mk-soft and DesktopMouseX(). I only see the debug output, which looks fine.

Peter
Post Reply