Creates a render target.

HTARGET Target_Create(
  int width,
  int height,
  bool zbuffer


Width of the render target to be created.
Height of the render target to be created.
If true, a Z-buffer will be created and used for rendering to the render target.

Return value

If successful, returns the render target handle to use with Gfx_BeginScene. Otherwise returns 0.


The render target dimensions must be a power of 2. If this condition isn't met, the requested dimensions are automatically adjusted to the closest power of 2 dimensions, bigger than the requested ones.

Render targets support alpha channel in 32-bit video modes only, in 16-bit video modes render targets are always opaque. You could read HGE_SCREENBPP system state to discover in what video mode HGE is currently running.

If the function fails, you may obtain error message with System_GetErrorMessage function. Also if HGE_LOGFILE system state was set, the error message is written to log.

When the render target isn't needed longer, you must delete it with Target_Free function.


Header: hge.h
Import library: hge.lib

See also