PB5.70 - DisplayTransparentSprite bug

Linux specific forum
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

PB5.70 - DisplayTransparentSprite bug

Post by Andre »

The following code runs fine on Windows, but does not on Linux (tested on Mint Mate 19.1 x64 and Ubuntu 18.10 x64, on VMware Player), here the box in the top-left corner displays a drawing error as you could see on the screenshot below. See the 'Fixme' note in the following test code, with which settings the bug occurs (it doesn't with PB5.62)...

Thanks for any more tests and feedbacks!

[Update: a possible workaround by limiting the 'Intensity' value is added in the commented code section...]

Code: Select all

; DisplayTransparentSprite() Bug PB570 Linux
; Demo code with workaround as temporary bugfix

EnableExplicit

; Workaround - PB570 Linux - DisplayTransparentSprite()
; CompilerIf #PB_Compiler_OS=#PB_OS_Linux
;   Procedure DisplayTransparentSprite_(output_ID, x, y, alpha)
;     If alpha>253 : alpha=253 : EndIf ; Mostly 254 works, but not ever, it look, it's available 253 work all over
;     DisplayTransparentSprite(output_ID, x, y, alpha)
;   EndProcedure
;   Macro DisplayTransparentSprite(output_ID, x, y, alpha=253)
;     DisplayTransparentSprite_(output_ID, x, y, alpha)
;   EndMacro
; CompilerEndIf

InitSprite()

Define i, ii, texture_ID, sprite_ID, sprite_1_ID, output_x, output_y, output_width=800, output_height=600
Define window_ID=OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, output_width, output_height, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If Not OpenWindowedScreen(WindowID(window_ID), 0, 0, output_width, output_height) : End : EndIf

Macro create_sprite
  If IsImage(texture_ID) : FreeImage(texture_ID) : EndIf
  If IsSprite(sprite_ID) : FreeSprite(sprite_ID) : EndIf
  texture_ID=CreateImage(#PB_Any, 200, 200)
  sprite_ID=CreateSprite(#PB_Any, ImageWidth(texture_ID), ImageHeight(texture_ID))
  StartDrawing(ImageOutput(texture_ID))
    DrawingMode(#PB_2DDrawing_Outlined)
    LineXY(0, 0, ImageWidth(texture_ID), ImageHeight(texture_ID), $FFFFFF) ; don't use black, as this is the pre-defined transparent color
    LineXY(ImageWidth(texture_ID), 0, 0, ImageHeight(texture_ID), $FFFF)
    Box(0, 0, ImageWidth(texture_ID), ImageHeight(texture_ID), $FF)
  StopDrawing()
EndMacro
create_sprite

sprite_1_ID=CreateSprite(#PB_Any, output_width, output_height)

Repeat
  
  Repeat ; Get all window events before FlipBuffers()
    Define win_event=WaitWindowEvent(1)
    If win_event=#PB_Event_CloseWindow
      End
    EndIf
  Until Not win_event
  
  FlipBuffers()
  ClearScreen(0)
  DisplaySprite(sprite_1_ID, 0, 0) ; Set a background before the output of the result - here in this snippet we use simply black
  StartDrawing(SpriteOutput(sprite_ID)) ; Draw the texture
  DrawImage(ImageID(texture_ID), 0, 0)
  StopDrawing()
  
  For i=0 To output_width
    For ii=0 To output_height
      ; DisplayTransparentSprite(sprite_ID, i, ii, 254) : ii+ImageHeight(texture_ID)-1 ; = OK
      ; FIXME - 255 on the following line will break the function (254 and all other values work)
      DisplayTransparentSprite(sprite_ID, i, ii) : ii+ImageHeight(texture_ID)-1
    Next
    i+ImageWidth(texture_ID)-1
  Next
  
ForEver
Image
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: PB5.70 - DisplayTransparentSprite bug

Post by ts-soft »

I can't see any error on Linux Mint 19.1 Cinnamon x64:
Image

Greetings - Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PB5.70 - DisplayTransparentSprite bug

Post by Andre »

Thank you, Thomas!

As this has probably something to do with the used Linux Distros then, any more test results are very welcome :-D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: PB5.70 - DisplayTransparentSprite bug

Post by Shardik »

No graphics error on Linux Mint x64 18.3 Cinnamon with PB 5.70 x64 on real hardware. Maybe your described problem is caused by testing on virtual machines. I would always advise to test on real hardware because especially graphics problems often arise because of bugs in the emulated graphics driver.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB5.70 - DisplayTransparentSprite bug

Post by mk-soft »

Works on Ubuntu 18.10 (VM under Parallels)
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
ccode
User
User
Posts: 99
Joined: Sat Jun 23, 2018 5:21 pm

Re: PB5.70 - DisplayTransparentSprite bug

Post by ccode »

Works on real hardware with Linux Mint LMDE 3 without problems.

How much graphics memory do you use with the virtual machine?
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB5.70 - DisplayTransparentSprite bug

Post by mk-soft »

VM Ubuntu 18.10
Memory: 1,9 GiB
Processor: Intel® Core™ i7-3615QM CPU @ 2.30GHz × 2
Graphics: Parallels using Intel HD Graphics 4000 OpenGL Engine
Graphics-Mem: 64 MB
Gnome: 3.30.1
OS: 64-bit
Virtual-Type: KVM
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
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PB5.70 - DisplayTransparentSprite bug

Post by Andre »

Thank you for your tests, friends! :D

So it seems so far, that there are probably no problems on a real Linux machine.... and like Shardik says, there are raised some issues with emulated hardware / GFX drivers.

If there are no further confirmations, I will move this topic to the regular Linux section later...
ccode wrote:How much graphics memory do you use with the virtual machine?
768 MB GFX memory, and 2 GB memory in total for the VM.
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PB5.70 - DisplayTransparentSprite bug

Post by Andre »

Further tests confirmed, that the above code runs well on native Linux (Mint Mate 19.1).

So there seems to be an error in the latest VMware Player version (v15.02), which worked well before with Linux and MacOS (and PB5.62). So this is now more post to "warn" about possible PB graphics problems, caused by VMware.

Topic moved to regular "Linux" section.

Thanks for all your tests & comments! :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply