[5.22 LTS] WindowEvent() destroys graphics
Posted: Thu May 15, 2014 8:44 pm
PB 5.22 LTS x86 Linux - UBUNTU 13.10
The title describes the bug.
Execute the code for a simple visual demonstration of the problem.
Graphics are created in a window, then a 3 second delay is forced on line 21.
You should change that Delay(3000) to observe the change in timing when the graphics destruction occurs.
After the delay, two variables are assigned values to control the triggering of a displayed message "AFTER 1 SECOND OF WindowEvent() CALLS".
After the delay and the two variables getting assigned, besides the WindowEvent() call, the only PureBasic code executing in the Repeat-Until loop during the one second when the graphics are destroyed, is the If test of the 2 control variables, and a Delay(2) call.
Of the code in that loop, I'm confident that it's the WindowEvent() call responsible for the damage, and the same result occurs with WaitWindowEvent().
This code works as expected in Windows, however it rarely runs the same way twice in Linux.
I made the RWB(x) procedure and called it 5 times (only changing the xposition parameter) to demonstrate how this simple and small procedure in Linux can produce inconsistent and glitchy results is such a simple program environment.
Obviously that glitchiness represents a separate bug, however I am at a loss how to define it, other than it glitches.
If the glitches happen for others, then perhaps another member with a better handle on this style of problem will submit a report detailing the bad behaviour.
** Based on the contents of this post, there may be some graphics problems specific to the 13.10 version of UBUNTU. **
The graphics glitches seem to be lessened when I run a compiled executable and I just ran a compiled version of the code above on a 13.04 (Raring Ringtail) x86 installation. Those semi random graphical glitches that are produced by the RWB() procedure calls on my system were not there.
However the graphics destruction error persisted.
My best guess as to the cause of the graphics destruction, is that something is interfering with the double buffering process.
The title describes the bug.
Execute the code for a simple visual demonstration of the problem.
Graphics are created in a window, then a 3 second delay is forced on line 21.
You should change that Delay(3000) to observe the change in timing when the graphics destruction occurs.
After the delay, two variables are assigned values to control the triggering of a displayed message "AFTER 1 SECOND OF WindowEvent() CALLS".
After the delay and the two variables getting assigned, besides the WindowEvent() call, the only PureBasic code executing in the Repeat-Until loop during the one second when the graphics are destroyed, is the If test of the 2 control variables, and a Delay(2) call.
Of the code in that loop, I'm confident that it's the WindowEvent() call responsible for the damage, and the same result occurs with WaitWindowEvent().
This code works as expected in Windows, however it rarely runs the same way twice in Linux.
Code: Select all
Procedure RWB(X)
StartDrawing(ScreenOutput())
DrawingFont(FontID(1))
DrawText(X,200,"RED",RGB(255,0,0))
DrawText(X,300,"WHITE",RGB(255,255,255))
DrawText(X,400,"BLUE",RGB(0,0,255))
StopDrawing() : FlipBuffers()
Delay(500)
EndProcedure
LoadFont(1,"Arial",24,#PB_Font_Bold|#PB_Font_HighQuality)
LoadFont(2,"Arial",12,#PB_Font_Bold|#PB_Font_HighQuality)
If InitSprite()=0 : End : EndIf
#FLAGS= #PB_Window_ScreenCentered|#PB_Window_MinimizeGadget
If OpenWindow(0,0,0,800,600,"SOFTWARE",#FLAGS)=0 : End : EndIf
If OpenWindowedScreen(WindowID(0),0,0,800,600,#True,0,0)=0 : End : EndIf
RWB(100) : RWB(200) : RWB(300) : RWB(400) : RWB(500)
StartDrawing(ScreenOutput()) : DrawingFont(FontID(2))
DrawText(150,500,"NOW A 3 SECOND DELAY BEFORE CALLING WindowEvent()",RGB(192,192,0))
StopDrawing() : FlipBuffers()
Delay(3000)
DRAWFLAG= 1
DRAWTIME= ElapsedMilliseconds()+1000
Repeat
If DRAWFLAG And DRAWTIME < ElapsedMilliseconds()
DRAWFLAG= 0
StartDrawing(ScreenOutput()) : DrawingFont(FontID(2))
DrawText(150,550,"AFTER 1 SECOND OF WindowEvent() CALLS",RGB(192,192,0))
StopDrawing() : FlipBuffers()
EndIf
Delay(2)
Until WindowEvent()= #PB_Event_CloseWindow
EndObviously that glitchiness represents a separate bug, however I am at a loss how to define it, other than it glitches.
If the glitches happen for others, then perhaps another member with a better handle on this style of problem will submit a report detailing the bad behaviour.
** Based on the contents of this post, there may be some graphics problems specific to the 13.10 version of UBUNTU. **
The graphics glitches seem to be lessened when I run a compiled executable and I just ran a compiled version of the code above on a 13.04 (Raring Ringtail) x86 installation. Those semi random graphical glitches that are produced by the RWB() procedure calls on my system were not there.
However the graphics destruction error persisted.
My best guess as to the cause of the graphics destruction, is that something is interfering with the double buffering process.