It is currently Wed Oct 23, 2019 7:17 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: PB5.70 - DisplayTransparentSprite bug
PostPosted: Sat Jan 05, 2019 4:25 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 6:14 pm
Posts: 1704
Location: Germany (Saxony, Deutscheinsiedel)
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:
; 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)


Top
 Profile  
Reply with quote  
 Post subject: Re: PB5.70 - DisplayTransparentSprite bug
PostPosted: Sat Jan 05, 2019 4:50 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5755
Location: Berlin - Germany
I can't see any error on Linux Mint 19.1 Cinnamon x64:
Image

Greetings - Thomas

_________________
PureBasic 5.71 | SpiderBasic 2.21 | Windows 10 Pro (x64) | Linux Mint 19.2 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: PB5.70 - DisplayTransparentSprite bug
PostPosted: Sat Jan 05, 2019 5:03 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 6:14 pm
Posts: 1704
Location: Germany (Saxony, Deutscheinsiedel)
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)


Top
 Profile  
Reply with quote  
 Post subject: Re: PB5.70 - DisplayTransparentSprite bug
PostPosted: Sat Jan 05, 2019 6:32 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1651
Location: Germany
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: PB5.70 - DisplayTransparentSprite bug
PostPosted: Sat Jan 05, 2019 8:38 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1973
Location: Germany
Works on Ubuntu 18.10 (VM under Parallels)

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: PB5.70 - DisplayTransparentSprite bug
PostPosted: Sat Jan 05, 2019 9:28 pm 
Offline
User
User

Joined: Sat Jun 23, 2018 5:21 pm
Posts: 99
Works on real hardware with Linux Mint LMDE 3 without problems.

How much graphics memory do you use with the virtual machine?


Top
 Profile  
Reply with quote  
 Post subject: Re: PB5.70 - DisplayTransparentSprite bug
PostPosted: Sat Jan 05, 2019 10:12 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1973
Location: Germany
VM Ubuntu 18.10
Quote:
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 / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: PB5.70 - DisplayTransparentSprite bug
PostPosted: Sat Jan 05, 2019 10:39 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 6:14 pm
Posts: 1704
Location: Germany (Saxony, Deutscheinsiedel)
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)


Top
 Profile  
Reply with quote  
 Post subject: Re: PB5.70 - DisplayTransparentSprite bug
PostPosted: Sun Jan 06, 2019 9:03 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 6:14 pm
Posts: 1704
Location: Germany (Saxony, Deutscheinsiedel)
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)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye