Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCA-1 produces visual glitches #9

Closed
falkTX opened this issue Oct 18, 2021 · 12 comments
Closed

VCA-1 produces visual glitches #9

falkTX opened this issue Oct 18, 2021 · 12 comments
Labels
bug Something isn't working

Comments

@falkTX
Copy link
Contributor

falkTX commented Oct 18, 2021

Not sure if issue with VCV or Cardinal.
But having this module on the board makes the entire plugin window green.
Moving VCA out of the way mitigates the issue.
Seems like the module is not closing/stopping a drawing operation properly, so the green used for its bars gets set for all modules.

@falkTX falkTX added the bug Something isn't working label Oct 18, 2021
@zezic
Copy link
Contributor

zezic commented Oct 18, 2021

For me it fills entire window with green only if its value is set below 0.005f, in another words, it does it when this condition is false: https://github.com/VCVRack/Fundamental/blob/v2/src/VCA.cpp#L242

But also, the following separators drawing procedure works in a strange way: https://github.com/VCVRack/Fundamental/blob/v2/src/VCA.cpp#L256-L262
The area it fills with black is too big:

And what's interesting, it renders correctly in the plugin browser, but not in the live mode.

@falkTX
Copy link
Contributor Author

falkTX commented Oct 18, 2021

You are correct that this only happens if value is below 0.005f.
I think the code from VCA is wrong, there is a nvgFillColor + nvgFill being called where there is a potential for no nvgRect (when all gains are below that value)

Before digging deeper into this, we need to see if the same happens with VCV as well. The v2 branch.

@zezic
Copy link
Contributor

zezic commented Oct 18, 2021

At least the latest binary build of Rack v2 is not affected by this issue. I think it has something to do with the way NanoVG operates in the Cardinal (GL?) environment. Maybe debugging the wrong drawing of the separators will give some answers.

@falkTX
Copy link
Contributor Author

falkTX commented Oct 18, 2021

good to know, thanks for checking.

I did some quick testing, and the area within the "meter" is simply not being drawn. if we extend the green area we can see the middle point where it should be drawn is the section where it is not.
Seems to me some logic is inverted somewhere.

@falkTX
Copy link
Contributor Author

falkTX commented Oct 18, 2021

To make more clear what I mean, I extended the green rectangle 50px on each side.

Screenshot_20211018_230318

But on the plugin browser it looks as intended.

Screenshot_20211018_230422

@falkTX
Copy link
Contributor Author

falkTX commented Oct 18, 2021

Oh, interestingly commenting out the separators makes the whole area bring drawn as expected.

Screenshot_20211018_230603

@zezic
Copy link
Contributor

zezic commented Oct 18, 2021

Yes. It's omething wrong with them. I have some ideas to test. Gonna try to debug it.

@falkTX
Copy link
Contributor Author

falkTX commented Oct 18, 2021

already found something, this code for the separators works:

		// Invisible separators
		const int segs = 25;
		for (int i = 1; i <= segs; i++) {
			nvgBeginPath(args.vg);
			nvgRect(args.vg,
			        r.pos.x - 1.0,
			        r.pos.y + r.size.y * i / segs,
			        r.size.x + 2.0,
			        1.0);
			nvgFillColor(args.vg, color::BLACK);
			nvgFill(args.vg);
		}

basically drawing each path separately.

so this is just joining each path together when drawing...?
there is an opengl config for this right?

@zezic
Copy link
Contributor

zezic commented Oct 18, 2021

You found it! :) I will try to search for anything related.
UPD: No luck for me anymore.

@falkTX
Copy link
Contributor Author

falkTX commented Oct 18, 2021

I also had no luck despite trying many things.
Because this is a very popular module and the bug makes the cardinal plugin unusable, I added a workaround in b3fd44c

@falkTX
Copy link
Contributor Author

falkTX commented Nov 10, 2021

Patch-fix has been submitted upstream in VCVRack/Fundamental#129

@falkTX
Copy link
Contributor Author

falkTX commented Nov 10, 2021

Since I take it that upstream is pretty much never going to respond to that, I just setup a fork https://github.com/CardinalModules/Fundamental

No more workarounds needed, plus we need to start forking a few modules to send patches upstream. Otherwise my falkTX account will be flooded with forks.
And we want to link/reference the submodules to good repositories with fixes, not original ones that have yet to see PRs merged.
So https://github.com/CardinalModules is born 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants