Expand description
FFI bindings to OpenCSG (image-based CSG rendering for OpenGL).
OpenCSG renders CSG (Constructive Solid Geometry) results directly into
the OpenGL depth buffer using the Goldfeather or SCS algorithms. After
calling render, re-render the primitives with GL_EQUAL depth
test to shade them.
Structs§
- Ocsg
Primitive - Opaque handle to an OpenCSG primitive.
Constants§
- ALGORITHM_
AUTOMATIC - Algorithm: automatic selection based on primitive properties.
- ALGORITHM_
GOLDFEATHER - Algorithm: Goldfeather (robust, handles concave primitives).
- ALGORITHM_
SCS - Algorithm: SCS (fast, convex primitives only).
- INTERSECTION
- Operation: the primitive is intersected into the CSG product.
- OPTION_
ALGORITHM - Option: which CSG algorithm to use.
- OPTION_
DEPTH_ COMPLEXITY - Option: depth complexity sampling strategy.
- OPTION_
OFFSCREEN - Option: offscreen buffer type.
- SUBTRACTION
- Operation: the primitive is subtracted from the CSG product.
Functions§
- free_
resources - Release OpenGL resources allocated by OpenCSG for the current context.
- init_gl
- Initialize OpenCSG’s internal GL loader. Call once after GL context is current.
- opencsg_
free_ resources - opencsg_
init_ gl - opencsg_
primitive_ ⚠free - opencsg_
primitive_ ⚠new - opencsg_
primitive_ ⚠set_ bounding_ box - opencsg_
render_ ⚠primitives - opencsg_
set_ option - primitive_
free ⚠ - Free an OpenCSG primitive.
- primitive_
new ⚠ - Create a new OpenCSG primitive.
- primitive_
set_ ⚠bbox - Set the bounding box on a primitive (normalized device coordinates).
- render⚠
- Perform CSG rendering on a list of primitive pointers.
- set_
option - Set an OpenCSG option (algorithm, depth complexity, offscreen type).
Type Aliases§
- Render
Fn - C callback type for rendering a primitive’s geometry.