Sample Code
The following is a list of code samples available to HOOPS Visualize developers. These samples are short snippets that demonstrate a specific functional topic. The source code for each sample is distributed as part of the Visualize package. The sample sources are located at <hps_install_dir>/samples/code/. To run a specific sample, you must first build the samples project. Then, execute the program and specify the sample name on the command line. Optionally, you can provide a driver to use as well.
For example, to run the "bloom_silhouette" sample using the OpenGL2 driver:
hps_samples.exe -t bloom_silhouette -d OpenGL2
This sample shows the user how to:
This sample shows the user how to:
-
Create a grid and use a complex clip region to clip it
This sample shows the user how to:
-
Set styles only when certain conditions are met
-
Include geometry only when certain conditions are met
-
Create named styles
-
Build complex conditions using logical operators
This sample shows the user how to:
-
Create a custom event
-
Create a custom event handler
-
Register an event
-
Get an event dispatcher and subscribe it to the custom event
-
Inject the custom event with a notifier
-
Wait for the event handling thread to terminate
This sample shows the user how to:
-
Load an HSF file and check for exceptions
-
Search the database for segments, shells, and vertices
-
Obtain a HPS::SearchResultsIterator object, and how to walk a search result list with the iterator
-
Inserting text through HPS::UTF8 objects
-
Setting a camera through a HPS::CameraKit object
This sample shows the user how to:
-
Walk the component structure of a HPS::CADModel
-
Highlight a specific instance of a component
-
Highlight all instances of a component
-
Build a HPS::KeyPath
-
Define a named style used for highlighting
This sample shows the user how to:
-
Import an Exchange file and check for exceptions
-
Traverse the component structure of a HPS::CADModel
-
Obtain a component from a selection event
-
Highlight a selected component
-
Define named styles and glyphs
This sample shows the user how to:
-
Load an Exchange file and check for IO exceptions
-
Walk down a component structure
-
Verify the type of a component
-
Defining named styles
-
Highlighting PMIs and geometry referenced by a particular PMI component
-
Hide components using highlighting
-
Use a HPS::KeyPath to operate on a particular instance of geometry
This sample shows the user how to:
-
Load an Exchange file through HPS::Exchange and check for Exchange IO exceptions
-
Output a 3D PDF file through HPS::Publish and check for Exchange IO exceptions
This sample shows the user how to:
-
Import an HSF file
-
Retrieve the size of the window at runtime
-
Export a 2D-PDF and PostScript file
-
Check whether the hardcopy export completed successfully
This sample shows the user how to:
This sample shows the user how to:
-
Load an HSF file and check for exceptions
-
Tweak segment level visibility using a HPS::VisibilityControl object
-
Set up a drawing to use hidden lines with shadows
This sample shows the user how to:
-
Load an HSF file
-
Load an image and use it to create a texture
-
Create an opaque style
-
Create a transparent style
-
Create a textured style
This sample shows the user how to:
-
Load an HSF file and check for exceptions
-
Search portfolio objects for image definitions
-
Applying portfolios to segments
-
Searching a list of named images
-
Applying an image as the window background
This sample shows the user how to:
-
Load a JPG file through HPS::Image and check for Image IO exceptions
-
Obtain an HPS::ImageKit and how to interact with it (obtain image size, image data, etc)
-
Convert an image between formats
-
Output an image to a file
-
Insert text using HPS::UTF8 objects
This sample shows the user how to:
-
Load an HSF file and check for exceptions
-
Create an offscreen window
-
Render to an offscreen window
-
Save a snapshot to disk
This sample shows the user how to:
This sample shows the user how to:
-
Create a material palette
-
Set colors on vertices using an HPS::RGBColor
-
Set colors on vertices using a material palette
-
Turning color interpolation on and off
This sample shows the user how to:
-
Load an HSF file and check for exceptions
-
Set up a legend, with a separate camera on the legend segment
-
Use of depth range and exclude bounding
This sample shows the user how to:
-
Insert a shell
-
Mask modelling matrix rotation, scaling, and translation
-
Rotate, scale, and translate a scene
This sample shows the user how to:
-
Insert a mesh
-
Set the normals on a mesh
-
Include segments into other segments
-
Set segment level attributes (color)
-
Change the modelling matrix
This sample shows the user how to:
-
Control the drawing order of co-planar geometry using SetPriority()
This sample shows the user how to:
-
Create a PDF file and insert a check box, button, and list box using HOOPS Publish
-
Demonstrate how to connect Javascript to a button
-
Output a the file through Publish and check for IO exceptions
This sample shows the user how to:
-
Load an HSF file and check for exceptions
-
Include segments into other segments
-
Setting different overlay settings (no overlay, normal overlay, overlay with z-value)
-
Shows performance difference between overlay styles
This sample shows the user how to:
-
Load an HSF file which contains a shell
-
Search the segment tree for the shell
-
Use reference geometry to instance the shell multiple times
This sample shows the user how to:
-
Load an HSF file and check for exceptions
-
Divide the screen into subwindows
-
Include segments into other segments
-
Render with flat shading, wireframe, hidden line, Gouraud, Phong algorithms
-
Use color index interpolation
This sample shows the user how to:
-
Insert a shell
-
Include a segment
-
Correctly delete included geometry
-
Change segment level attributes (face color, edge color, face visibility, edge visibility)
-
Use transparency
-
Use subwindows
This sample shows the user how to:
-
Perform an analytic selection
-
Perform a visual selection
See also: Programming Guide
section 6.3, "selection" sample
This sample shows the user how to:
-
Insert a shell
-
Include a segment
-
Change shell level attributes (face color, vertex color, vertex visibility, face visibility)
This sample shows the user how to:
-
Load an HSF file and check for IO exceptions
-
Define a glyph to be used as a marker symbol
-
Define a named style
-
Select a single instance of an entity
-
Modify selection option and selectability
-
Highlight selected geometry
This sample shows the user how to:
-
Insert a shell
-
Set segment level attributes (color)
-
Insert a spotlight
This sample shows the user how to:
-
Insert a shell
-
Divide the screen into sub-windows
-
Change shell-level attributes
This sample shows the user how to:
-
Load an HSF file and check for exceptions
-
Load an image file through HPS::Image and check for Image IO exceptions
-
Search the database for segments, and iterate through a list of search results
-
Create a portfolio
-
Define textures with Sphere, Cylinder and UV parameterizations
-
Apply textures to geometry