================= Application setup ================= Every application that uses HNP must instantiate an `HPS::World `_ object before any HPS API calls are made. Additionally, this World object must stay in scope for the application's lifetime. In *CHPSApp.cpp*, you can see that the World object is initialized with the `license key `_. This is an essential step which must not be missed - the application will not work without it! .. literalinclude:: /source/CHPSApp.cpp :language: c :start-after: //! [hps_init] :end-before: //! [hps_init] Additionally, notice the material library and font directory locations are set above. These settings are not required, but they do set up the default locations where HNP will look for materials and fonts. See more about application setup `here `_. Next, you need to connect your application to HNP so that HNP can render into it. This is typically accomplished by passing a window handle to an `HPS::ApplicationWindowKey `_ object, as shown in *CHPSView.cpp*: .. literalinclude:: /source/CHPSView.cpp :language: c :start-after: //! [window_handle] :end-before: //! [window_handle] Notice that we are creating the window and immediately assigning it to an `HPS::Canvas `_ object. This happens during the initial update made by MFC. From now on, any rendering calls made by HNP will be sent to this canvas, which in turn passes it into the lower-level graphics hardware. The `HPS::Canvas `_ object is part of the view hierarchy, explained in the next section.