Difference between revisions of "DEPTHBUFFER"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>SMcNeill
(style guidelines; also: broken link to screenshot removed)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:_DEPTHBUFFER}}
{{DISPLAYTITLE:_DEPTHBUFFER}}
The '''_DEPTHBUFFER''' statement turns depth buffering ON or OFF, LOCKs or _CLEARS buffering
The [[_DEPTHBUFFER]] statement turns depth buffering ON or OFF, LOCKs or _CLEARS the buffer.






{{PageSyntax}}
{{PageSyntax}}
::: '''_DEPTHBUFFER''' {ON|OFF|LOCK|_CLEAR}[,handle]
: [[_DEPTHBUFFER]] {ON|OFF|LOCK|_CLEAR}[,handle&]




{{PageDescription}}
{{PageDescription}}
* Buffering can be turned ON or OFF, LOCKed or _CLEARed. Default is ON, so ON should only be used if OFF was previously used.
* 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.
* An image handle is optional. [[_DEST]] could also be used.
* 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:''
{{PageSeeAlso}}
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.
 
[http://i301.photobucket.com/albums/nn53/burger2227/YUNEEEDaDEPTHBUFFER.png You need a _DEPTHBUFFER]
 
 
 
''See also:''
* [[_MAPTRIANGLE]]
* [[_MAPTRIANGLE]]
* [[_PUTIMAGE]]
* [[_PUTIMAGE]]

Latest revision as of 17:00, 5 September 2017

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.


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page