-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Solved the issue with Pan y-axis inverted in frameBuffer. #6545
Conversation
I am not entirely sure if this was supposed to be done here. @davepagurek |
I believe now it's inverted if you aren't using a framebuffer: let layer;
function setup() {
createCanvas(400, 400, WEBGL);
layer = createFramebuffer();
}
function draw() {
// layer.begin();
orbitControl();
background(220);
sphere(150);
// layer.end();
// image(layer,-width/2,-height/2)
} I think rather than multiplying by -1, we should be multiplying by the |
src/webgl/interaction.js
Outdated
@@ -229,7 +229,7 @@ p5.prototype.orbitControl = function( | |||
deltaPhi = sensitivityY * this.movedY / scaleFactor; | |||
} else if (this.mouseButton === this.RIGHT) { | |||
moveDeltaX = this.movedX; | |||
moveDeltaY = (this.movedY * -1); | |||
moveDeltaY = (this.movedY * (cam.projMatrix.mat4[5] < 0 ? 1 : -1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for accessing the projection matrix rather than using cam.yScale
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, i just confused with the y-scale. now i have done the changes. it's working fine as you told
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess both have the same sign?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I think the yScale value is used in creating the projection matrices. In the end I think they should be equivalent, but it's maybe just more readable to see a value like yScale
than an index into a matrix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, Got it now. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this works, although we probably could remove the brackets for legibility. Just to confirm, is your sketch updated with the latest version of the code? The sketch seems to work well
yes..my code is up to date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good then, thanks!
Thank you for catching mistakes. I decided to use a projection matrix because it was working, and I just thought if yscaling cause any issues further. |
Resolves #6538
Changes:
https://editor.p5js.org/aman12345/sketches/Fu-bC-xWm