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

ofPolyline smoothed seems broken in nightly #6414

Closed
ofZach opened this issue Oct 30, 2019 · 2 comments
Closed

ofPolyline smoothed seems broken in nightly #6414

ofZach opened this issue Oct 30, 2019 · 2 comments

Comments

@ofZach
Copy link
Contributor

ofZach commented Oct 30, 2019

was just working with a student and we noticed ofPolyline::getSmoothed() seems broken on nightly.

example code:

ofPolyline line;
for (int i = 0; i < 100; i++){
        float angle = ofMap(i, 0, 100, 0, PI);
        line.addVertex(400 + 200 * cos(angle),
                       400 + 200 * sin(angle));
    }
line = line.getSmoothed( (int)ofMap(mouseX, 0, ofGetWidth(), 0, 11));
line.draw();

in 0.10.1 it works as expected (half-circle shrinks slightly as you move the mouse), in nightly when you move the mouse over it does something strange.

investigating...

@ofTheo
Copy link
Member

ofTheo commented Oct 30, 2019

wow - I think this is another case of a bug with glm now not initializing variables by default.
hard to catch because of the templating.

https://github.com/openframeworks/openFrameworks/blame/master/libs/openFrameworks/graphics/ofPolyline.inl#L490

			T cur;

is not initialized so has garbage values.
Try changing it to:

			T cur(0);

See: #6397 (comment)

I am more and more tempted to do our next release with:
#define GLM_FORCE_CTOR_INIT 1

Or document really well the switch and how the #define can be used if needed.

@ofTheo ofTheo mentioned this issue Oct 30, 2019
35 tasks
@ofZach
Copy link
Contributor Author

ofZach commented Oct 30, 2019

yeah I was just about to say, I tracked it down to T cur being different on the two releases :)

T cur(0) definitely fixes. I wonder if there are other subtle issues w/ initializing we should be looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants