FBC-Dev 1.06.0 (32/64), problem(s)

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

FBC-Dev 1.06.0 (32/64), problem(s)

Post by MrSwiss »

I've just tried the latest builds, with the following results (both: WIN-standalone):

FB 1.06.0 - 32 (GFX-lib), shows white (on black background), while the same program compiles
and runs *as expected* in the 64bit version ... (also no problems, in both FBC 1.05.0 versions).

FB 1.06.0 - 64 (GFX-lib), a regression bug, it seems (as it is also in the 1.05.0 - 64 version):
when doing a compile+run (from IDE) the program does not *have the focus*, unlike 32bit ver.

The code used for testing (giving above problems):

Code: Select all

' GFX_MATH_Test2.bas -- 2017-05-06, by MrSwiss
' last update: 2017-05-06   changed: ---

' compile with: -s GUI

#Include Once "GFX_MATH.bi"     ' see: https://freebasic.net/forum/viewtopic.php?f=7&p=231423#p231423

' for program execution control
Dim As Boolean  quit = FALSE    ' flag(s)

' ===== MAIN =====
ScreenRes(641, 641, 32, 2, 64)  ' GFX_ALPHA_PRIMITIVES = &h40 / 64 dec; double buffer

Do
    For j As UInteger = 0 To 10         ' rows (steps vertical)
        Var y = j * 55                  ' calc. y-axis pos.
        For i As UInteger = 0 To 10     ' columns (steps horizontal)
            Var x = i * 55              ' calc. x-axis pos.
            Var h = IRange(25, 85)      ' get a random height between 25 and 85
            Var w = IRange(35, 150)     ' get a random width between 35 and 150
            Line (x, y)-Step(w, h), RndARGB, BF ' random color full ARGB range
        Next
        If Len(InKey()) Then quit = TRUE : Exit For ' exit outer For loop (only)
    Next
    Flip
    If quit Then Exit Do                ' end prog. (if quit = TRUE)
    Sleep 1000, 1 : Cls                 ' give user some time, to 'look at it'
Loop
' ===== END-MAIN =====  ' ----- EOF -----
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: FBC-Dev 1.06.0 (32/64), problem(s)

Post by counting_pine »

Code: Select all

' random Color ARGB range, ULong (random Alpha & Color)
#Define RndARGB         ( CULng(Rnd() * &hFFFFFFFF) )
It looks like this code basically returns CULng(Rnd() * -1) in 32-bit mode, which will either be opaque white or transparent black.

A better version would be: CULng(Int(Rnd() * &h100000000)). Although it depends on there being a high enough granularity in the Rnd() function, otherwise lower channels won't be very random.

Could you provide a simpler/more specific example for the focus problem, and which versions/architectures it's OK/broken under?
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: FBC-Dev 1.06.0 (32/64), problem(s)

Post by MrSwiss »

counting_pine wrote:

Code: Select all

' random Color ARGB range, ULong (random Alpha & Color)
#Define RndARGB         ( CULng(Rnd() * &hFFFFFFFF) )
It looks like this code basically returns CULng(Rnd() * -1) in 32-bit mode, which will either be opaque white or transparent black.
Yes, you are correct, I'll re-write it, by forcing ULong (for 32-bit), without changing the range.
That is probably the reason, it works flawlessly, in 64-bit. (where Integer: 64-bit)

Code: Select all

#Define RndARGB         ( CULng(Rnd() * &hFFFFFFFFul) )
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: FBC-Dev 1.06.0 (32/64), problem(s)

Post by MrSwiss »

counting_pine wrote:Could you provide a simpler/more specific example for the focus problem, and which versions/architectures it's OK/broken under?
"more specific" isn't needed (IMHO) because, it affects any program, using fbGFX and 64-bit compilers.

Let me explain the setup, specifically:
  • OS: Win10 pro 64
  • IDE: FbEdit 1.0.7.6c
  • Compiler(s): 1.05.0 / 1.06.0, both 64bit (vs. their 32bit versions)
  • All Compilers used: Win/standalone (out of the box = unmodified, in any way)
"compile + run" (aka: green arrow), result is:
FbEdit = still "on top / active" -- fresh compiled program is only seen, on the "Task-Bar",
needs a mouse-click, to become "on top" + "has focus" ... (not so, with any 32bit FBC,
they're straight away: "on top" + "has focus".)

All console programs, are not at all affected (aka: run as expected, with any tested
Compiler/bit ness)!
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: FBC-Dev 1.06.0 (32/64), problem(s)

Post by counting_pine »

OK. Does the use of '-s gui' or GFX_ALPHA_PRIMITIVES make any difference to the focusing behaviour?
Is the window invisible, or is it just covered by the foreground window?
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: FBC-Dev 1.06.0 (32/64), problem(s)

Post by MrSwiss »

counting_pine wrote:OK. Does the use of '-s gui' or GFX_ALPHA_PRIMITIVES make any difference to the focusing behaviour?
The difference is with -s GUI (vs. -s console). Since, as soon as we have a console open "first",
even if thereafter, the graphics Window is created, everything is "as expected".
GFX_ALPHA_PRIMITIVES makes no difference, as previously stated.
counting_pine wrote:Is the window invisible, or is it just covered by the foreground window?
It is covered by the foreground window, however, with FbEdit: FbEdit keeps "focus", and funnily
program also, has "focus" ?? -- while --
when *.exe is started "independently" (e.g. from File-Explorer, with double-click) it has "focus"
and, File-Expl. looses "focus" but, is still covering the "active" program.
Post Reply