Win32 DirectX Fastgraph/Light


int fg_vballoc (int width, int height);

Function fg_vballoc (ByVal width As Long, ByVal height As Long) As Long

function fg_vballoc (width, height : integer) : integer;


The fg_vballoc() function creates a virtual buffer of the specified size. The memory for the virtual buffer is allocated automatically. Virtual buffers are usually created in the WM_CREATE message handler.

In Fastgraph's DirectX libraries, fg_vballoc() can create virtual buffers in system memory or in video memory. By default, it will create virtual buffers in system memory, but you can change this through fg_ddmemory().


width is the virtual buffer width in pixels. If necessary, the width is extended to a multiple of four bytes.

height is the virtual buffer height in pixels.

Return value

If successful, fg_vballoc() returns a handle by which the virtual buffer is referenced (between 0 and 255). If unsuccessful, possible return codes are -1 (virtual buffer table full) or -2 (cannot allocate memory for the virtual buffer).



See also

fg_ddmemory(), fg_vbdefine(), fg_vbdepth(), fg_vbfree(), fg_vbinit(), fg_vbopen()


First and nearly all the other example programs use this function.

Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.