kittykatattack / learningPixi

A step-by-step introduction to making games and interactive media with the Pixi.js rendering engine.
4.41k stars 849 forks source link

Enabling depth buffer? #147

Open borisblizzard opened 4 years ago

borisblizzard commented 4 years ago

So I've been trying to enable a depth buffer for the default framebuffer (or the used render texture), but I haven't been able to actually find that particular instance of the RenderTexture or Framebuffer object. I can confirm that it works fine if I set Framebuffer.depth to true and call Framebuffer.addDepthTexture() somewhere after the creation and then use the needed GL calls to make it work, but I obviously don't want every framebuffer to have a depth buffer (and I want to make sure that it's cleared properly on every buffer swap).

So, any ideas how I can make this work? Just being able to fetch the Framebuffer object and the current RenderTexture object that's rendered onto before that texture itself is drawn onto the Framebuffer object.

I'm using v5.2.4.