Z-Buffer Management

Fastgraph implements z-buffers much like virtual buffers. That is, you create z-buffers with fg_zballoc(), which returns a handle that you pass to fg_zbopen() to activate the z-buffer. This process, which would most likely appear in a program's WM_CREATE handler, is shown here:


int hZB;
hZB = fg_zballoc(vbWidth,vbHeight);


hZB : integer;
hZB := fg_zballoc(vbWidth,vbHeight);

Visual Basic:

Dim hZB As Long
hZB = fg_zballoc(vbWidth, vbHeight)
Call fg_zbopen(hZB)

Before your program exits, you pass the handle to fg_zbfree() to release the z-buffer memory:

C/C++ and Delphi:


Visual Basic:

Call fg_zbfree(hZB)

The fg_zbfree() call will usually be in a program's WM_DESTROY handler.

Before rendering all 3D objects in a scene, we'll probably clear the active virtual buffer to erase the contents of the previous frame. When we do this, we must also call fg_zbframe() to prepare the z-buffer for the next frame. The fg_zbframe() function has no parameters and no return value.

<< Prev

Next >>

Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.