In this tutorial, we'll show you one of the simplest and most useful operations for visualization applications - loading a model and rendering it in a window. This basic task is at the core of most applications, and it's easy to do with HOOPS Native Platform.
As mentioned in the Getting Started section, HNP is made up of HOOPS Visualize, HOOPS Exchange, and HOOPS Publish. We'll quickly demonstrate how to leverage these libraries to make a simple application which you can build on as you evaluate the product. The HOOPS Visualize portion of the tutorial is implemented by the HPS API, so wherever you see "hps" in a filename, or HPS as a namspace, this is what it is referring to. This tutorial will be using Visual Studio on Windows. You will also need to install the VS 2015 C++ Windows native libraries if not already installed.
The first thing we need to do is set up the environment and initialize the system. To do this, unzip your HNP package to a convenient location, and navigate to HNP_INSTALL_DIR/samples/hoops/hps_basic. This folder contains the project file for this tutorial. Open it your in your IDE.
The hps_basic project is set up to build out of the box, referencing all the necessary libraries. For convenience, those libraries are listed below:
- hps_core.lib - This is the core of the HOOPS Visualize system and is always required.
- hps_sprk.lib - This is the "Sprockets" library. Sprockets is the HOOPS Visualize term for an extension or module. If you are using any Sprockets modules, this library is required.
- hps_sprk_ops.lib - This is the Sprockets operator library. An operator manages interaction between the user and HOOPS Visualize window, such as key presses and mouse movements.
- hps_sprk_exchange.lib - The Sprockets Exchange library manages the interface between HOOPS Visualize and HOOPS Exchange, which is used for model reading and writing.
You'll also notice that the include directory is set to <HNP_INSTALL_DIR>/hps/include. The last thing is to simply make sure the DLLs are present in the working directory. For this tutorial, all of this has been configured for you.
One last thing before we start
We've tried to make this tutorial as simple as possible. However, one fundamental thing to understand is the concept of segments. HOOPS Visualize arranges its internal data as a tree hierarchy of nodes, also known as a scene graph. Each node in the scene graph is called a segment. A segment can contain geometry, configuration information (commonly called attributes), camera settings, and much more. For example, when a model is imported, its data is copied into a segment, and this segment usually contains subsegments of its own. There is a lot more to know about the power of segments, but for now, it is enough to understand that they contain information and exist as a way to optimize and organize a scene.
This is all that's needed to start working with HOOPS Native Platform. For this tutorial, we aren't using any GUI frameworks - all the code is native HOOPS API code. Feel free to compile and run the hps_basic project now, then read on for more information about how it works.