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

Fix bug in ortho() where using it without arguements, drawing failed in some cases, resolved. #6639

Merged
merged 2 commits into from
Dec 21, 2023
Merged

Fix bug in ortho() where using it without arguements, drawing failed in some cases, resolved. #6639

merged 2 commits into from
Dec 21, 2023

Conversation

diyaayay
Copy link
Contributor

@diyaayay diyaayay commented Dec 17, 2023

Resolves #6621

Changes:
In src/webgl/p5.Camera.js :
if (far === undefined) far = Math.max(this._renderer.width, this._renderer.height)+800;

In test/unit/webgl/p5.Camera.js :
var expectedMatrix = new Float32Array([ 0.019999999552965164, 0, 0, 0, 0, -0.019999999552965164, 0, 0, 0, 0, -0.002222222276031971, 0, -0, -0, -1, 1 ]);

Screenshots of the change:

Before:
image

function setup() {
  createCanvas(400, 400, WEBGL);
  ortho();
}

function draw() {
  background(220);
  box(100);
}

image

function setup() {
  createCanvas(100, 100, WEBGL);
  ortho();
}

function draw() {
  background(220);
  box(50);
}

image

PR Checklist

@diyaayay
Copy link
Contributor Author

Waiting for a review. Perhaps @davepagurek or anyone?
Thanks.

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing the fix and updating the test!

@davepagurek davepagurek merged commit ce50455 into processing:main Dec 21, 2023
2 checks passed
@davepagurek davepagurek mentioned this pull request Jan 21, 2024
17 tasks
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

Successfully merging this pull request may close these issues.

Due to #6216, If ortho() is used without arguments, drawing may fail in some cases
2 participants