hidden_surface(3G)
NAME
hidden_surface − enable/disable hidden surface removal
SYNOPSIS
C Syntax:
int hidden_surface ( fildes, hsr_on, cull_on );
int fildes, hsr_on, cull_on;
FORTRAN77 Syntax:
integer*4 function hidden_surface ( fildes, hsr_on, cull_on )
integer*4 fildes, hsr_on, cull_on
Pascal Syntax:
function hidden_surface ( fildes, hsr_on, cull_on:integer ):integer;
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
hsr_on Flag to enable/disable hidden surface processing. If hsr_on is TRUE (1), hidden surface processing is enabled. If FALSE (0), hidden surface processing is disabled.
cull_on Flag to enable/disable back-facing polygon cull. If cull_on is TRUE (1), culling is enabled; if FALSE (0), culling is disabled.
Discussion
Hidden_surface specifies whether or not hidden surface removal is to be performed. If hsr_on is FALSE (0), output primitives are drawn without regard to hidden surface processing. If hsr_on is TRUE (1), output primitives are drawn using Z-buffer hidden surface removal.
Hidden_surface returns the number of times polygon information must be sent for a complete picture. If the function returns a number greater than one, the data must be sent n times and calls must be made to zbuffer_switch to render the entire area. This number is a function of the size of the display area to be used for hidden-surface-removal rendering and the size of the Z-buffer. The portion of the display surface to be used for hidden-surface-removal rendering is defined by the viewport limits (see view_port), and the size of the Z-buffer can be set in a device-dependent manner using gescape.
When hidden_surface is enabled on a device that has a Z-buffer smaller than the entire display, the clip limits are set to the intersection of the Z-buffer limits, the view port (as set by view_port), and the current clip limits (as set by clip_indicator). On devices which have a Z-buffer the same size as the display, the clip limits are left as the current clip limits set by clip_indicator.
The Z-buffer may be cleared with calls to zbuffer_switch or clear_view_surface. See these two routines and clear_control for details.
When hidden surface removal is enabled, functions that alter the Z-buffer configuration (and hence, possibly the number of passes needed for hidden surface removal) are not allowed. This includes any functions that change VDC units (also changing the size of the viewport). Functions that generate an error if called with hidden surface enabled are shade_mode, double_buffer, view_port, vdc_extent, mapping_mode, set_p1_p2, and vdc_justification.
If cull_on is TRUE (1) and the graphics device has been opened in MODEL_XFORM mode (see gopen), polygons with normals facing away from the viewer are not rendered. The normals may be generated or supplied with each polygon (see vertex_format). If cull_on is FALSE (0), all polygons are rendered. Note that back-face color as set by the color parameter of backface_control(3G) has no effect on back-facing polygons unless cull_on is FALSE.
In order for back-face cull to work properly with perspective views, the position of the viewer must be set with either view_camera or viewpoint. If the user is not using view_camera, but is doing his own perspective viewing matrix using view_matrix3d, the viewpoint function must be called with a POSITIONAL viewpoint to set the position of the viewer. See viewpoint(3G).
Recommendation
Enable front and back clipping (with depth_indicator) when depth cueing is enabled.
RETURN VALUE
The hidden_surface call returns the number of drawing passes needed to render a picture based on the available Z-buffer memory.
DEFAULTS
hsr_on = FALSE (0): draw output primitives without hidden surface removal
cull_on = FALSE (0): all polygons rendered
SEE ALSO
Starbase Reference: backface_control(3G), clear_control(3G), clear_view_surface(3G), gopen(3G), vertex_format(3G), view_camera(3G), view_port(3G), viewpoint(3G), zbuffer_switch(3G).
Starbase Graphics Techniques. Starbase Device Drivers Manual.
Hewlett-Packard Company — November 03, 1994