Active Forums => QB64 Discussion => Topic started by: thesolarcode on May 13, 2021, 03:53:00 pm
Title: Help: code not blending to complete black color
Post by: thesolarcode on May 13, 2021, 03:53:00 pm
I have this code and thought that with the _RGBA alpha setting (line 67) drawing over the whole screen the image should get darker and darker, but somehow the lines are stuck at some very dark grey color. Any idea how I can fix this?
Title: Re: Help: code not blending to complete black color
Post by: bplus on May 13, 2021, 04:36:43 pm
The screen is actually transparent until you cls, just cls will give default black background. That might help?
Hey nice effect!
Title: Re: Help: code not blending to complete black color
Post by: thesolarcode on May 13, 2021, 05:04:10 pm
Thanks,
Not sure how to use CLS without destroying the line effect - I only draw one additional line per screen update, all the other lines are just made darker with one command :) I'm probably doing the wrong thing - am I effectively just setting transparency to 25% and thus lines are still visible?
Title: Re: Help: code not blending to complete black color
Post by: bplus on May 13, 2021, 05:08:41 pm
Oh just do it first thing before you start drawing, that sets the background to Black instead of transparent which looks black with no drawings on it.
I think you've got it right just CLS first thing, once, before drawing.
Title: Re: Help: code not blending to complete black color
Post by: FellippeHeitor on May 13, 2021, 05:38:39 pm
thesolarcode: I've tried to understand the effect you're seeing with programs I'd written before, like fireworks and others. I never managed to understand why it doesn't eventually end up blacking the whole screen - those trails will remain there until you actually clear the screen with full alpha. I managed to observe the same outcome while playing with other programming languages too, it's still a mystery to me.
Here, try this one: https://openprocessing.org/sketch/1191793 (same technique of semi-transparent black rectangle to cover previous frame - same trail effect (defect)).
Title: Re: Help: code not blending to complete black color
Post by: johnno56 on May 14, 2021, 03:41:27 am
I had a little problem when I ran this.... Cut and paste into IDE then F5. A small black window view appeared in the top left corner of the screen just for a moment. Pressed F5 again. The black window view appeared again and the whole display locked up. Rebooted. Re-ran. F5 black window again for a moment. F5 and the program ran normally. Escape to end. Tried again and the black window appeared again and locked up the system. Each time it locked up, the only two thing that worked was mouse movement and the system reset button....
I checked the listing. There doesn't seem to be anything there tat I have not used before (except for checking:off).
The time that it ran, it ran very well... I see what you mean about the 'dark grey' lines. Looks a lot like the qbasic screen saver, Mystify... Cool...
As the listing looks 'normal', I'm going to assume that the problem may be with my machine, and pass on running again until I try to figure out the problem.
I am running on Linux Mint 20, 64bit using QB64 1.5 stable from git 3043116
Title: Re: Help: code not blending to complete black color
Post by: johnno56 on May 14, 2021, 03:48:22 am
Ok. First test... Removal of 'checking:off'. Successfully ran the program 7 times in succession... Locked up on the 8th try.... Oh well.... Worth a shot...
Title: Re: Help: code not blending to complete black color
Post by: thesolarcode on May 14, 2021, 04:53:42 am
I changed the code a bit - this time I copy an image over and over to achieve the fading effect, but I have the same problem with the faded lines being still visible. I guess there is no other way in QB64 as to darken/fade each pixel individually, right?
Title: Re: Help: code not blending to complete black color
Post by: johnno56 on May 14, 2021, 06:28:32 am
It's not just QB64. Because of my "screen lock" issue, I tried to replicate the problem, using RCBasic. No screen lockup but the "dark line" issue was still there. Reducing the "alpha" to "30" reduced it a little... Too low and the display looks like only a few lines or too high and the "grey line" is more obvious. I will continue to research...
Title: Re: Help: code not blending to complete black color
Post by: johnno56 on May 14, 2021, 09:17:28 am
Here is a rough conversion of a javascript example (
)
Even in the JS version, the remnants of the fading, was still present.
Title: Re: Help: code not blending to complete black color
Post by: thesolarcode on May 15, 2021, 02:32:34 am
Yes, that is it - the effect looks really great now (even better if you decrease by 1 - then it fades really slowly towards black color). Today I learned something new (how to use MEMGET/PUT for gfx). Thanks :)
Title: Re: Help: code not blending to complete black color
Post by: NOVARSEG on May 15, 2021, 03:09:54 am
Decrease by 1 does look better.
Title: Re: Help: code not blending to complete black color
Post by: NOVARSEG on May 15, 2021, 03:51:29 am
small bug . changed FOR T = 0 TO (800 * 600 - 1) * 4 STEP 4 to FOR T = 0 TO 800 * 600 * 4 - 1 STEP 4