PEXBeginPickOne - Begin Renderer Pick One (5.1)


Synopsis

 
   void PEXBeginPickOne(
        Display *display,
        Drawable drawable,
        PEXRenderer renderer,
        long structure_id,
        int method,
        int pick_device_type,
        PEXPickRecord *pick_record
   )
 

Arguments

display
A pointer to a display structure returned by a successful XOpenDisplay call.

drawable
The resource identifier of a drawable.

renderer
The resource identifier of the renderer

structure_id
A value to be used as an application-specified structure identifier.

method
The pick one method (PEXPickLast, PEXPickClosestZ, PEXPickVisibleAny or PEXPickVisibleClosest).

pick_device_type
The pick device type (PEXPickDeviceDCHitBox or PEXPickDeviceNPCHitVolume).

pick_record
A pointer to the pick data record.

Returns

None.

Description

Invoke PEXBeginPickOne to start an immediate-mode pick, setting the renderer's renderer state to PEXPicking.

When the renderer state is PEXPicking, primitives are hit tested instead of converted to pixels. For pick one, a hierarchical path to the picked primitive is maintained.

PEXlib defines the following pick one methods:

PEXPickLast -
Returns the last "hit" primitive which satisfies the pick filter test.

PEXPickClosestZ -
Returns the "hit" primitive which has a z value closest to the front clipping plane and satisfies the pick filter test. If multiple primitives satisfy this criteria, any of them may be returned.

PEXPickVisibleAny -
Returns any "hit" primitive which is visible (taking the current HLHSR mode into account) and satisfies the pick filter test.

PEXPickVisibleClosest -
All "hit" primitives which are visible are selected. Of those selected, the one which is closest to the pick position and satisfies the pick filter test is returned. If you specify an NPC pick volume, then the pick position is the center of the volume.

To determine the supported pick device types, invoke the PEXGetEnumTypeInfo function.

The specified structure identifier is inserted as the first structure component in the returned pick path.

If the specified drawable does not have the same root and depth as the drawable that was used to create the renderer, or, if the implementation does not support the specified drawable, then the implementation issues a BadMatch error. To determine the supported drawables, invoke the PEXMatchRenderingTargets function. If the renderer state is set to PEXRendering or PEXPicking when you invoke this function, then the operation in progress is aborted, the PEXBeginPickOne function is completed, and the implementation issues a BadPEXRendererState error.

When the renderer state is PEXPicking, you can invoke any function which processes output commands or manipulates attributes (e.g., all output command functions, PEXBeginStructure, PEXEndStructure, PEXRenderElements, and PEXAccumulateState). These functions have the same semantics except that primitives are hit tested instead of converted to pixels.

Errors

BadAlloc
The implementation failed to allocate resources necessary to complete request.

BadDrawable
The specified drawable resource identifier is invalid.

BadMatch
The specified drawable is unsupported, or the specified renderer resource was not created with a compatible drawable.

BadPEXRenderer
The specified renderer resource identifier is invalid.

BadPEXRendererState
The specified renderer was not PEXIdle.

BadValue
The pick record contains invalid data, or the pick device type is invalid.

See Also

For a list of all Renderer Pick functions and related topics, see Renderer Picking.