RotateSprite issue under DirectX9
Posted: Fri Jul 25, 2025 10:40 pm
Hey all,
noticed an issue with RotateSprite(), only apparent with subsystem DirectX9 (no issues under OpenGL or DirectX11).
When rotating a perfectly square sprite 90° or 180° or 270°, the new Sprite is cut off by 1 Pixel, and also shifted, so there's one line now 2px wide, while one side is missing a line.
Only happens with values 90, 180 and 270.
But see for yourself:
Thanks. 
noticed an issue with RotateSprite(), only apparent with subsystem DirectX9 (no issues under OpenGL or DirectX11).
When rotating a perfectly square sprite 90° or 180° or 270°, the new Sprite is cut off by 1 Pixel, and also shifted, so there's one line now 2px wide, while one side is missing a line.
Only happens with values 90, 180 and 270.
But see for yourself:
Code: Select all
EnableExplicit
InitSprite()
InitMouse()
InitKeyboard()
#xRes= 800
#yRes = 600
Define screen = OpenWindow(#PB_Any, 0, 0, #xRes, #yRes, "Sprite Rotating under DirectX9", #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(screen), 0, 0, #xRes, #yRes)
Define event
Define spriteSPR = CreateSprite(#PB_Any, 64,64, #PB_Sprite_AlphaBlending | #PB_Sprite_Transparent)
If StartDrawing(SpriteOutput(spriteSPR))
DrawingMode(#PB_2DDrawing_Outlined)
Box(0,0,64,64,RGB(0,255,0))
Box(0,0,32,32,RGB(0,255,0))
StopDrawing()
EndIf
TransparentSpriteColor(spriteSPR, RGB(0,0,0))
RotateSprite(spriteSPR, 90, #PB_Absolute)
Repeat
ClearScreen(RGB(0,0,0))
ExamineMouse()
DisplayTransparentSprite(spriteSPR, MouseX(), MouseY())
FlipBuffers()
Repeat
event = WindowEvent()
If event = #PB_Event_CloseWindow
Break
EndIf
Until event = #Null
ExamineKeyboard()
Until event = #PB_Event_CloseWindow Or KeyboardReleased(#PB_Key_Escape)
End
