The HOOPS Visualize installation includes simple applications for a variety of GUI technologies. These applications provide a framework for the tutorials discussed later in this guide, and can also serve as containers for prototyping code. This section reviews how to start with a simple HOOPS Visualize application and insert a 'HelloWorld' text string in the scene-graph. Select the GUI technology that you wish to prototype with:
The MFC demonstration application can be found in the HOOPS Visualize solution, mfc_simple_vcXX project. Open the file SampleHView.cpp and find the function OnRunMyCode(). After recomipling the project, the following code will be run when you start the application and click the down arrow:
void CSampleHView::OnRunMyCode() { HC_Open_Segment_By_Key(m_pHView->GetModelKey()); { HC_Insert_Text(0, 0, 0, "Hello world"); } HC_Close_Segment(); m_pHView->Update(); }
This code does the following:
This tutorial describes how to take the reference ATL control (called the HOOPS 3D Stream Control), and display the text 'Hello World' in the viewport. It assume some familiarity with ATL. Developers are encouraged to read through the HOOPS/ActiveX documentation to get an idea of what the sample ATL control is all about.
The source source code and project files for the HOOPS 3D Stream Control is located in <hoops>/demo/atl/Hoops3dStreamCtrl/source. Recompile and expermient with the control by going to the Streaming Gallery at www.hoops3d.com
Let's modify the application to display the 'Hello World' text each time a new window is opened. This can be achieved by adding code to the CHoops3dStreamCtrl::InitModel method which does the following:
The modified sample code for:
void class CHoops3dStreamCtrl::InitModel() { ... if (!m_pModel) { m_pModel = new HBaseModel (); m_pModel->Init(); HC_Open_Segment_By_Key(m_pModel->GetModelKey()); HC_Insert_Text(0.0f, 0.0f, 0.0f, "Hello World"); HC_Close_Segment(); } }
Generally, the reference control's source code should not be modified to dynamically create graphical primitives. Rather, it should be referenced on a webpage to automatically stream in pre-created HSF files, and/or could could be dynamically interacted with from a webpage via it's public COM interface. Again, the HOOPS/ActiveX documentation provides details.
This tutorial describes how to take the precreated 'simple' HOOPS/Winforms application and display the text 'Hello World' in the viewport. You may wish to first review the HOOPS/Winforms documentation to get an idea of the structure of the provided application.
There are 2 HOOPS/Winforms examples, one for VB.Net and one for C#.Net. Their source code and project files are located in <hoops>/demo/csharp/csharp_simple, and <hoops>/demo/visual_basic/vb_simple. Compile and run the one that you're interested in to make sure your development environment is setup correctly.
Let's modify the application to display the 'Hello World' text each time a new window is opened. This can be achieved by adding code to the custom HSimpleModel constructor which does the following:
The modified sample code for:
The sample code would be added to the HSimpleModel::Init method in SimpleHNPanel.cs
public class HSimpleModel : HBaseModel { ... override public void Init() { base.Init(); HCS.Open_Segment_By_Key(GetModelKey()); HCS.Insert_Text(0.0f, 0.0f, 0.0f, "Hello World"); HCS.Close_Segment(); } ... }
The sample code would be added to the HSimpleModel::Init method in SimpleHNPanel.vb
Public Class HSimpleModel Inherits HBaseModel ... Public Overrides Sub Init() MyBase.Init() HCS.Open_Segment_By_Key(GetModelKey()); HCS.Insert_Text(0.0f, 0.0f, 0.0f, "Hello World"); HCS.Close_Segment(); End Sub 'Init ... End Class 'HSimpleModel
This tutorial describes how to take the precreated 'simple' HOOPS/QT application and display the text 'Hello World' in the viewport. You may wish to first review the HOOPS/QT documentation to get an idea of the structure of the provided application.
The source code to the simple HOOPS/Qt application is located in <hoops>/demo/qt/qt_simple. (The QT4 variant is located in <hoops>/demo/qt/qt_simple_4.) Compile and run it to make sure your development environment is setup correctly.
Let's modify the application to display the 'Hello World' text each time a new window is opened. This can be achieved by adding code to the custom HOOPS/QT widget's constructor which does the following:
The modified SimpleHQWidget constructor would look like the following:
SimpleHQWidget::SimpleHQWidget(QWidget* parent, const char* name, const char * filename) : HQWidget( parent, name ) { CreateMenus(); // Create and initialize HOOPS/MVO Model and View objects m_pHBaseModel = new HBaseModel(); m_pHBaseModel->Init(); HC_Open_Segment_By_Key(m_pHBaseModel->GetModelKey()); HC_Insert_Text(0.0f, 0.0f, 0.0f, "Hello World"); HC_Close_Segment(); // Initialize View object to null ; gets created in SimpleHQWidget::Init m_pHView = 0; // if called with a file name we load it // otherwise open an empty view if(filename) m_pHBaseModel->Read(filename); // enable MouseMoveEvents setMouseTracking(true); // enable key events setEnabled(true); setFocusPolicy(QWidget::StrongFocus); }
Note that the sample code could have also been inserted in an overloaded method of HBaseModel::Init.
This tutorial describes how to take the precreated 'simple' HOOPS/Java application and display the text 'Hello World' in the viewport. You may wish to first review the HOOPS/Java documentation to get an idea of the structure of the provided application.
The source code to the simple HOOPS/Java application is located in <hoops>/demo/java/java_simple. Follow the steps in the readme.txt file to recompile and run it.
Let's modify the application to display the 'Hello World' text each time a new window is opened. This can be achieved by adding code to the Init method of the custom HBaseModel class (HSimpleModel::Init) which does the following:
The modified HSimpleModel::Init method would look like the following:
class HSimpleModel extends HBaseModel { ... public void Init() { super.Init(); HJ.Open_Segment_By_Key(GetModelKey()); HJ.Insert_Text(0.0f, 0.0f, 0.0f, "Hello World"); HJ.Close_Segment(); } ... }
Note that the sample code could have also been inserted in an overloaded method of HBaseModel::Init