_DEPTHBUFFER - QB64 Wiki

_DEPTHBUFFER

From QB64 Wiki

Jump to: navigation, search

The _DEPTHBUFFER statement turns depth buffering ON or OFF, LOCKs or _CLEARS the buffer.


Syntax:

_DEPTHBUFFER {ON|OFF|LOCK|_CLEAR}[,handle]


Description:

  • Depth buffers store the distance of each pixel on an image/surface. When 3D drawing occurs new pixels are only drawn if they are closer than the existing pixels. After all content is drawn, it results in a scene which looks correct because content which is closer hides content which is further away.
  • Depth buffers are automatically created for any hardware image or surface which is the target/destination of a 3D command (such as the 3D version of _MAPTRIANGLE).
  • The buffering can be turned ON, OFF or LOCKed. The default state is ON.
  • _DEPTHBUFFER _CLEAR can be used to reset/erase the depth buffer, meaning that future drawing will not be blocked by existing/previously buffered depth content.
  • Whenever _DISPLAY is called the primary surface's depth buffer is automatically _CLEARed, so unless you are drawing onto a hardware image you may never need to use this option.
  • LOCKing the depth buffer makes it read only. New content cannot be drawn unless it is closer than existing content, but when that new content is drawn it will not update the depth buffer.
  • Turning OFF or LOCKing the depth buffer is typically performed when semi-transparent content is being drawn.

Photo: Here's another screenshot which shows rending to 2d images then rendering to the screen. The difference is that QB64 is adding a hardware depth-buffer to the destination images on demand when and if it requires one. Note which image is not using a depth-buffer. In QB64 a depth-buffer is implied unless you specifically state not to use one.

You need a _DEPTHBUFFER


See also:



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
Views
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in
Toolbox
  • What links here
  • Related changes
  • Special pages
  • Printable version