The sample VTP ActiveX control (vtocx)
The VTP runtime is very flexible. It can run inside almost any
application framework, on any platform, including an ActiveX control (.ocx), for
embedding a 3D scene inside a web page viewed with Internet Explorer (or any other OLE container). There
is a very simple example, vtocx, which shows how to do this. It is (so
far) a very basic 'alpha release'.
Basic Documentation
- Download the file vtocx_1201.zip.
This contains the ocx control itself, the DLLs it uses, and an example HTML
page showing how to embed the OCX inside a web page.
- Unzip it into a folder on the target machine. For ease of testing,
i'd recommend putting it on some machine that's already got some VTP data on it.
Note: these DLLs are built with VC7.1, so they are not the same ones as in the VTP distribution, even
though some have the same names. They should stay together with the .ocx
so that the .ocx can find them. Don't put them on your system path, or
anything like that.
- Open up a command prompt. Change directory (CD) to the folder you
unzipped. Give the
command:
regsvr32 vtocx.ocx
It should think for a second, then report "...vtocx.ocx succeeded."
If it does not succeed, then you won't be able to proceed. It can be
difficult to troubleshoot DLL registration issues. You could ask someone
with a deep knowledge of Microsoft OS behavior, or consult these Microsoft documents:
- Open the provided file "ocx.html" in a text editor.
This is a web page which shows how to put the 3D in a web page.
Find the two lines which look like this:
<param name="TerrainPaths"
value="C:/VTP/TerrainApps/vtocx/Data/" />
<param name="TerrainFile" value="Terrains/Simple.xml" />
- Change the values to point to where your data is. (Note that the OCX
will already automatically use all the VTP's paths if run on a machine that
already has the VTP installed.) Don't forget that trailing slash at the
end of TerrainPaths.
For example:
<param name="TerrainPaths" value="C:/Program
Files/VTP/Data/" />
<param name="TerrainFile"
value="Terrains/Generic Terrain.xml" />
You can put several foldersin TerrainPaths if you like, separated with
semicolons.
- Launch Internet Explorer and open your HTML file.
If your security settings pop up a warning about running some control on the
page, tell it it's OK to let the control run.
- You should see something that looks like this:
Web Developer Documentation
The OCX control defines several parameters, properties, and
methods. This means that the web page can easily interact with the 3D
scene from Javascript. See the provided HTML file for examples.
- Properties:
- NavSpeed (float), the current navigation speed in meters per second.
- PositionX (float), the X location of the camera, in terrain
coordinates.
- PositionY (float), the Y location
- PositionZ (float), the Z location
- Methods:
- ResetView() will set the camera's location back to where it was
initially
C++ Developer Documentation
The OCX parameters, properties, and methods can be extended by
anyone with a knowledge of VTP, MFC and OLE. The project is in the VTP
source under VTP/TerrainApps/vtocx. There is a workspace and project file
provided for MSVC 7.1. It is not provided for MSVC 8.0, because that
version is usually an 'Express Edition' which does not have MFC. If you
have a 'full' version of VC8 that includes MFC, then you could probably import
the VC 7.1 project into 8.0, although you might have deal with the tricky issue
of 'manifests'.