Skip to content

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

Merged
davepagurek merged 2 commits into
processing:mainfrom
diyaayay:bugfix/6621-use-ortho-without-arguements
Dec 21, 2023
Merged

Fix bug in ortho() where using it without arguements, drawing failed in some cases, resolved.#6639
davepagurek merged 2 commits into
processing:mainfrom
diyaayay:bugfix/6621-use-ortho-without-arguements

Conversation

@diyaayay

@diyaayay diyaayay commented Dec 17, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

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

@davepagurek davepagurek left a comment

Copy link
Copy Markdown
Contributor

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
@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