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

91
Views
Espere hasta que WebGL se haya dibujado en la pantalla

Cambié de usar contexto 2D a usar contexto WebGL . Estoy tratando de encontrar una manera de esperar hasta que los píxeles se dibujen en la pantalla.

Con contexto 2D haría algo como esto

 const handlePaintFrame = () => { const ctx: CanvasRenderingContext2D | any = videoCanvasRef?.current?.getContext("2d"); if (video.current && videoCanvasRef.current && ctx) { if (chroma?.keyColor) { drawChromaFrame(ctx, width, height); } else { ctx.drawImage(video.current, 0, 0, width, height); } const rendered = () => { setTimeout(() => { onReady("video"); }, 20); }; const startRender = () => { requestAnimationFrame(rendered); }; const img = new Image(); img.onload = () => { requestAnimationFrame(startRender); }; img.onerror = (e: any) => { console.log("Image error:", { e }); }; img.src = videoCanvasRef.current.toDataURL(); } };

Actualmente, mi código de dibujo para el contexto WebGL es algo como esto

 const drawTexture = () => { // render if (gl && video.current) { gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, video.current); drawScene(locationRef.current, buffersRef.current); } }; const handlePaintFrame = () => { if (video.current) { if (chroma?.keyColor) { // drawChromaFrame(ctx, width, height); } else { drawTexture(); // TODO: We need to wait until texture is drawn setTimeout(() => { onReady("video"); }, 100); } } };
about 4 years ago · Juan Pablo Isaza
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!