Page 2 of 3
Re: Inconsistant Openwindow()
Posted: Thu Mar 17, 2022 4:01 am
by idle
ok I was going to ask if this this looks ok and reports the correct values for Width and if Resolutions = 1
Try PB6.00 it's only in beta for the c backend the fasm code is stable
Code: Select all
ExamineDesktops()
Debug "width " + DesktopWidth(0)
Debug "height " + DesktopHeight(0)
Debug "Res x " + DesktopResolutionX()
Debug "Res y " + DesktopResolutionY()
Dw = DesktopWidth(0)
Dh = DesktopHeight(0)
W=1500
H=1500
If InitSprite() = 0
MessageRequester("Error", "Can't open screen & sprite environment!", 0)
End
EndIf
#autoscale=0
#FLAGS = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered
If OpenWindow(0,0,0,W,H,"Windowed screen test ",#FLAGS)
If #autoscale
res = OpenWindowedScreen(WindowID(0),0,0,W,H,#autoscale,0,0)
Else
res = OpenWindowedScreen(WindowID(0),0,0,DW,DH,#autoscale,0,0)
EndIf
If res
CreateSprite(0, 50, 50) ; Create an empty sprite, will be whole black
Repeat
Repeat
Event = WaitWindowEvent(10)
If Not #autoscale
w = WindowWidth(0)
EndIf
If Event = #PB_Event_CloseWindow
End
EndIf
Until Event = 0
FlipBuffers()
ClearScreen(RGB(0, 0, 200)) ; A blue background
DisplaySprite(0, 10, 10) ; Display our black box at the left-top corner
DisplaySprite(0, W-60, 10); Display our black box at the right-top corner
DisplaySprite(0, 10, H-150)
DisplaySprite(0,W-60,H-150)
out.s = Str(W)
If StartDrawing(ScreenOutput())
DrawText((W>>1)-(TextWidth(out)>>1),100,out,RGB(0,255,0),RGB(0,0,255))
StopDrawing()
EndIf
ForEver
Else
MessageRequester("Error", "Can't open windowed screen!", 0)
EndIf
Else
MessageRequester("Error", "Can't open windowed!", 0)
EndIf
Re: Inconsistant Openwindow()
Posted: Thu Mar 17, 2022 8:30 am
by BarryG
Changing the code or debugging it is not the issue. The issue is the same code running differently in different IDE tabs.
Re: Inconsistant Openwindow()
Posted: Thu Mar 17, 2022 9:36 am
by idle
Unless the problem can be identified it isn't going to get fixed. It's not a pb issue
Re: Inconsistant Openwindow()
Posted: Thu Mar 17, 2022 10:03 am
by BarryG
Why is it not a PB issue? I would expect the exact same code to compile/run the same no matter which IDE tab it's in. No?
It's like pasting this code into 4 different tabs and running them, but the last one opens a 640x480 window for some reason:
Code: Select all
OpenWindow(0,0,0,320,240,"test",#PB_Window_SystemMenu)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Because that's what this bug report is about:
ppnl wrote: Mon Mar 14, 2022 6:13 amJust past the code I pasted above in four different tabs and then run them one after the other.
Re: Inconsistant Openwindow()
Posted: Thu Mar 17, 2022 12:06 pm
by tored
I can't get this to look right at all, as shown in the video with the red exploding and then imploding circle, for me it always look broken, the grey and black noise, regardless of tab I'm compiling from.
PureBasic 5.73 LTS (Windows - x64)
AMD Ryzen 5 PRO 4650GE with Radeon Graphics
Re: Inconsistant Openwindow()
Posted: Thu Mar 17, 2022 12:39 pm
by darius676
Do you use DPI settings in the Compiler Options and DesktopResolution when creating the window?
Re: Inconsistant Openwindow()
Posted: Fri Mar 18, 2022 8:53 pm
by ppnl
idle wrote: Thu Mar 17, 2022 4:01 am
ok I was going to ask if this this looks ok and reports the correct values for Width and if Resolutions = 1
Try PB6.00 it's only in beta for the c backend the fasm code is stable
Code: Select all
ExamineDesktops()
Debug "width " + DesktopWidth(0)
Debug "height " + DesktopHeight(0)
Debug "Res x " + DesktopResolutionX()
Debug "Res y " + DesktopResolutionY()
Dw = DesktopWidth(0)
Dh = DesktopHeight(0)
W=1500
H=1500
If InitSprite() = 0
MessageRequester("Error", "Can't open screen & sprite environment!", 0)
End
EndIf
#autoscale=0
#FLAGS = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered
If OpenWindow(0,0,0,W,H,"Windowed screen test ",#FLAGS)
If #autoscale
res = OpenWindowedScreen(WindowID(0),0,0,W,H,#autoscale,0,0)
Else
res = OpenWindowedScreen(WindowID(0),0,0,DW,DH,#autoscale,0,0)
EndIf
If res
CreateSprite(0, 50, 50) ; Create an empty sprite, will be whole black
Repeat
Repeat
Event = WaitWindowEvent(10)
If Not #autoscale
w = WindowWidth(0)
EndIf
If Event = #PB_Event_CloseWindow
End
EndIf
Until Event = 0
FlipBuffers()
ClearScreen(RGB(0, 0, 200)) ; A blue background
DisplaySprite(0, 10, 10) ; Display our black box at the left-top corner
DisplaySprite(0, W-60, 10); Display our black box at the right-top corner
DisplaySprite(0, 10, H-150)
DisplaySprite(0,W-60,H-150)
out.s = Str(W)
If StartDrawing(ScreenOutput())
DrawText((W>>1)-(TextWidth(out)>>1),100,out,RGB(0,255,0),RGB(0,0,255))
StopDrawing()
EndIf
ForEver
Else
MessageRequester("Error", "Can't open windowed screen!", 0)
EndIf
Else
MessageRequester("Error", "Can't open windowed!", 0)
EndIf
Ok, I ran it and it displayed the correct resolution and debug reported 3840x2160 res x 1 and res y 1.
Then I exited out and restarted purebasic. I ran three other tabs first then ran it. It displayed the wrong oversized window and debug reported the same 3840x2160 with x 1 and y 1 res. No joy.
Re: Inconsistant Openwindow()
Posted: Fri Mar 18, 2022 9:07 pm
by ppnl
idle wrote: Thu Mar 17, 2022 9:36 am
Unless the problem can be identified it isn't going to get fixed. It's not a pb issue
It seems to me that something in the PB IDE must be getting corrupted. Otherwise how do you explain the code working in the first three tabs I run (any first three tabs!) and not working in the fourth tab. (any fourth tab!). And the code I posted is dirt simple. If there is an error in the code then someone should see it. And the problem exists even with code I got from a text teaching purebasic.
It cannot be a coding error.
Something is getting corrupted. I don't know if it is a bad interaction with the video drivers or with windows or what. But that inconsistent behavior on identical code means something is getting corrupted in the IDE.
Re: Inconsistant Openwindow()
Posted: Fri Mar 18, 2022 9:21 pm
by ppnl
tored wrote: Thu Mar 17, 2022 12:06 pm
I can't get this to look right at all, as shown in the video with the red exploding and then imploding circle, for me it always look broken, the grey and black noise, regardless of tab I'm compiling from.
PureBasic 5.73 LTS (Windows - x64)
AMD Ryzen 5 PRO 4650GE with Radeon Graphics
Maybe you should upload a video.
But it does not display red circles. It displays fuzzy red circles. And it does so on square sprites that don't use any kind of transparency. So when the sprites get close enough together the black corners overlap some of the fuzzy red circles. So it may look noisy.
The original code comes from the online book here:
http://nomad.uk.net/downloads/PureBasic ... 0Guide.pdf
Just go to the chapter explaining how to open windows and screens. The book is a version out of date but is still mostly good.
Re: Inconsistant Openwindow()
Posted: Fri Mar 18, 2022 9:28 pm
by ppnl
darius676 wrote: Thu Mar 17, 2022 12:39 pm
Do you use DPI settings in the Compiler Options and DesktopResolution when creating the window?
No but even if I did it would give consistent results and not depend on running other tabs or the order That I run the tabs.
I didn't even see a DPI setting in compiler options. Where is that?
Re: Inconsistant Openwindow()
Posted: Fri Mar 18, 2022 10:13 pm
by ppnl
So far there are two of us who see the problem. The only point of commonality that I see is the 20 series geforce graphics card. If anyone with a 20 series card does not see the problem please speak up. I have no idea how or if a graphics card can cause this but it is the only thing I have.
Re: Inconsistant Openwindow()
Posted: Fri Mar 18, 2022 10:59 pm
by darius676
DPI settings are in the Compiler Options, I m not sure when the support for this feature started, it was one of the 5.7x versions I think. Now with 6.x it is supported.
If you want try my new game, which uses DPI settings and should be displayed correctly on any screen resolution and zoom,(minimum resolution 1280x720, maximum 4K and maybe up to 8K...)
https://mark-dowen.itch.io/thorins-worl ... g-title
Re: Inconsistant Openwindow()
Posted: Fri Mar 18, 2022 11:51 pm
by idle
ppnl wrote: Fri Mar 18, 2022 10:13 pm
So far there are two of us who see the problem. The only point of commonality that I see is the 20 series geforce graphics card. If anyone with a 20 series card does not see the problem please speak up. I have no idea how or if a graphics card can cause this but it is the only thing I have.
Its very odd behavior for sure but it does seem to be a windows or driver issue if it's only happening to you and paul with the same set up, maybe Paul can help you figure out what's actually going on.
Re: Inconsistant Openwindow()
Posted: Fri Mar 18, 2022 11:52 pm
by BarryG
Some graphics driver cards have features to override game resolutions automatically. I wonder if that's the case here?
But that doesn't explain why the exact same code in four different tabs can make the fourth tab run the code differently to the first three.
Re: Inconsistant Openwindow()
Posted: Sat Mar 19, 2022 12:04 am
by idle
BarryG wrote: Fri Mar 18, 2022 11:52 pm
Some graphics driver cards have features to override game resolutions automatically. I wonder if that's the case here?
But that doesn't explain why the exact same code in four different tabs can make the fourth tab run the code differently to the first three.
Yes its really odd, it could also be windows defender doing tricks, I went nuts a couple of weeks ago debugging some code and then it eventually dawned that the compiler wasn't actually updating the executable, it was being blocked by windows offender without any notification and just running the stale copy.