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

texture() doesn't work with push and pop #7385

Open
1 of 17 tasks
jacopomazzoni opened this issue Nov 20, 2024 · 1 comment
Open
1 of 17 tasks

texture() doesn't work with push and pop #7385

jacopomazzoni opened this issue Nov 20, 2024 · 1 comment

Comments

@jacopomazzoni
Copy link

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
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

1.11.1

Web browser and version

p5js editor, firefox and chrome latest lts tested

Operating system

mac and win

Steps to reproduce this

Steps:

  1. tested the file ( a bent plane with an image texture ) loads ok see sketch: https://editor.p5js.org/jacopom/sketches/fX6YlQimX
  2. tested in my 3d particles example and the texture doesn't work: https://editor.p5js.org/jacopom/sketches/qSLLcrpSi
  3. commenting out lines 70 and 75 (push and pop) prevents the translate rotate etc from working but fixes the missing texture

Snippet:

    //relevant method of the particle class
    push();
        rotateY(this.yangle);
        translate(this.x, this.y, this.z)
        model(leafModel);
        texture(leafTexture);
        pop();
@ffd8
Copy link
Contributor

ffd8 commented Nov 24, 2024

@jacopomazzoni – just checking out issues thread and can lend a quick answer here. It is working – however texture() should be assigned before the model(), similar to fill()/stroke() style properties. It was working without push()/pop(), because it was being set at the bottom and then continued working on next draw cycle. It happens so fast, one doesn't notice. With the texture not appearing when under the model within a push/pop, actually means it is working since it's preventing anything else from knowing that texture was set. Hope that helps!

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

No branches or pull requests

2 participants