WebGL Framebuffer with Renderbuffer

Swipe to View Overlapping Shapes

Framebuffer with Texture Color Attachment & Renderbuffer Depth Attachment

Two shapes intersect and rotate in the foreground. With depth testing enabled, fragments in front display over fragments behind. Edges of the shapes disappear when they cut through the back edges of the cube environment. The shapes correctly display intersection. Without depth testing the second shape draws over the first shape.

Render to texture with depth requires both gl.enable(gl.DEPTH_TEST) and a depth buffer.

Learn 3D Programming with Screen Shots Learn 3D Programming with Screen Shots
Copyright © 2015 Seven Thunder Software. All Rights Reserved.