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

ortho() rendering blank canvas #6755

Closed
2 of 17 tasks
wagedu opened this issue Jan 21, 2024 · 8 comments · Fixed by #6758
Closed
2 of 17 tasks

ortho() rendering blank canvas #6755

wagedu opened this issue Jan 21, 2024 · 8 comments · Fixed by #6758

Comments

@wagedu
Copy link

wagedu commented Jan 21, 2024

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build Process
  • Unit Testing
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.9

Web browser and version

all

Operating System

all

Steps to reproduce this

Steps:

  1. Add ortho()
  2. Nothing is displayed
  3. Add orbitControl. Still nothing displayed, until one "uses" it (ie. scroll or drag) Then the content is rendered

Snippet:

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

function draw() {
  background(220);
  orbitControl();
  ortho();
  sphere(100)
}
@alokdangre
Copy link

Can I work on this issue?! @wagedu

@Vishal2002
Copy link
Contributor

@wagedu Bro when I am running the given code I get the spehere with grid.Can you explain what is the issue ?

Screenshot 2024-01-21 163931

@davepagurek
Copy link
Contributor

I think this may be due to the default near/far values of ortho not having been updated along with some camera changes in 1.9. I believe this has been addressed in #6639, maybe someone can confirm whether this is reproducible with the recent beta build?

@wagedu
Copy link
Author

wagedu commented Jan 21, 2024

@Vishal2002 Mate, does it appear BEFORE you interact?

To me it doesn't UNTIL interaction.
Attached it not appearing in Firefox & Safari, just in case.

Screen Shot 2024-01-21 at 15 16 29
Screen Shot 2024-01-21 at 15 18 04

@wagedu
Copy link
Author

wagedu commented Jan 21, 2024

Also, @davepagurek maybe I should be asking this on the Discord but... do you know of any workaround to make this work in the current 1.9? I tried setting/unsetting a custom camera without luck.
Thanks!

@davepagurek
Copy link
Contributor

Here are the new default values: https://github.com/diyaayay/p5.js/blob/dc065a2b99fe8110fc617da5682620cc1f444fed/src/webgl/p5.Camera.js#L908-L915

Maybe try setting these manually in your ortho call instead of omitting the parameters? i.e.:

ortho(-width/2, width/2, -height/2, height/2, 0, max(width, height) + 800)

@wagedu
Copy link
Author

wagedu commented Jan 21, 2024

@davepagurek , thanks, now it works perfectly.

Previously I had tried with the values given in the reference, where the "far" value is 500, instead of max(w,h) + 800
And also has the top/bottom signs inverted

Thanks a lot!

@davepagurek
Copy link
Contributor

Good point, I think the translate(0,0,500) in the example is maybe misleading, as it is compensating for the far value. I'll see if I can update that for this next release.

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

Successfully merging a pull request may close this issue.

4 participants