Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

104
Views
How to make createCapture(VIDEO) image to be absolute among other objects inside code?

I have this p5 project where using camera to output the feed from it in my game, but the camera output seems to say behind game and idk how to make it appear as a first layer to the top of the game. How can I do it? TIA!

Code for camera, I am using but it works here, since there is no game here

let cap;
function setup() {
  createCanvas(400, 400);
  cap = createCapture(VIDEO);
  cap.hide();
  imageMode(CENTER);
}
function draw() {
  background(50);
  image(cap, mouseX, mouseY, 160, 120);
}

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

In p5.js there are no layers or stacking order. In 2d mode elements are stacked in the order they are drawn. So the first thing you draw will be the bottom most, and the last thing you draw will be the top most. In WEBGL mode everything you draw does have a z position and each element may be hidden or clipped if it is behind things already drawn in the same frame. In between frames something called the "depth buffer" is cleared so that all elements drawn on the next frame will be displayed without regard for the elements drawn in the previous frame.

You can actually clear the depth buffer during a single frame to simplify layering things in WEBGL. For more info see this answer.

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!