Introduction

This is an ActiveX control based on the OpenGL library, which allows you to plot three-dimensional data. The control is entirely written on ATL/STL, and does not link to MFC libraries.

The control can perform the following functions:

Axis customization, including customizable font, colors, and titles.

Plot a large number of points and updating one or more plots on the graph with new data, replacing the old plot with the new plot.

Plot the multiple elements with individual properties such as line and point color, line width, and point size.

Lighting

Plot styles: {0 (Lines); 1 (Points); 2 (LinePoint); 3 (Surface)}

By setting the Projection property you should be able to change the viewing to: (0) Perspective (in which objects that are closer appear larger), and (1) Orthographic (in which the sizes and angles between objects are maintained no matter what their distance from the viewer).

By setting the TrackMode property you should be able to do: (1) Zooming, (2) Rotation, and (3) Panning at runtime.

About the Code

To use this control, embed it in an application that supports the use of ActiveX controls. Microsoft Visual Basic applications, all MS Office applications, VBScript and JavaScript in the HTA or Internet Explorer applications, and applications created with the Microsoft Developer Studio’s AppWizard can support the use of ActiveX controls.

Before you start, the control must be register as a COM component using Regsvr32.exe. Regsvr32 takes one argument the DLL or control to register and any of several command-line switches, the most notable of which is /u to uninstall a control. By default that is, when run with only a dll or ocx Regsvr32.exe registers the control.

Note: you must do this on every computer that you are going to use the control!

For more information on how to register and how to include the control in a VC Project, refer to my article 2D Graph ActiveX Control.

Bellow are two listings that demonstrates how to use the control to draw a Torus:

Comments and Discussions

Initially looked promising, but lack of documentation, (apparent) lack of ability to swap axes (so that Z is up/down, not Y!!) , (apparent) lack of ability to set & lock min/max values of each axis, renders this control rather useless for my particular project.

i am trying to plot surface graph (similar to example "double sine" but solid) and set color of surface based on Z value.
am not sure if i use this properly but i am having some problems. so far i am still playing with the code trying to see how to use it.
for example right now i just use lineplot (modified from "double sine" example) and while plot looks fine, it is next to impossible to see anything because everything is same color.
i can change color but is always applied to entire graph not just line i am ploting.
i expect that after each ".AddElement", and it's ".ElementLineColor(n)=RGB(100 + (n mod 128), 0,0)" i color set for only that element (".PlotXYZ X, Y, Z, n").
for some reason it does not work (or maybe I am not understanding how this is supposed to be used).

I am confused by this project. After spending many hours locating and correcting errors and

eliminating myriad warnings so that the NTGraph3D_src project would compile on Visual Studion

2008, I find there remain a couple of unresolved issues.

1) if this is supposed to generate an ActiveX control, why is no OCX file generated ?
2) the only library files generated are the NTGraph3D.dll and the associated NTGraph3D.lib
3) a Custom Build error occurs in every configuration
4) it is not possible to register the NTGraph3D.dll using regsvr32.exe
When attempts are made to do so using regsvr32.exe NTGraph3D.dll, the following message is

posted:

The NTGraph3D.dll was loaded, but the DLLRegisterServer entry point was not found.
This file cannot be registered.

Further, when the src project generated NTGraph3D.dll is placed in the root directory of the demo project, an Assertion Violation is encountered:

I apologize for my ignorance concerning ATL ActiveX controls. I have discovered that my above post is completely in error. In fact, MSDN provides a detailed walk-through on how to create such an ActiveX control.

see: http://msdn.microsoft.com/en-us/library/cb1kcads(v=vs.90).aspx

Once certain corrections are made in the NTGraph3D_src program, the code will compile using Visual Studio 2008. Further, the Custom Build Event to register the dll will work (Vista requires run as admistrator).
Once the dll is registered, the Demo3D will run but the 'torus' selection causes a runtime error related to some vector subscript boundary error. Similarly, the Torus demo will compile but encounters an immediate runtime error, likely for the same vector boundary reason.

I want to thank Ido Ben-Ami for restimulating my interest in this topic. With his help, I was able to correct the NTGraph3D_src to produce a workable dll.

I fail to see how making Alexander Chernosvitov 's code into an ActiveX control adds much utility. I believe that ActiveX controls have fallen out of fashion. It would be nice if the author would update this code without involving ActiveX. Then it would be extremely useful to many. As it is, it is full of errors and warnings when one attempts to compile it in VS 2008. While I certainly appreciate the effort the author put into this, I hope he or someone can update it. Still gets a 5 from me, but it's now too long in the tooth.

If you don't really care about OpenGL and just need to plot something that looks 3D,
here is simple alternative. this code uses just series of lines drawn on a form
or Picturebox to present sort of landscape.
i don't recall where i saw the original code but here is modified version.
it allows simple scale and rotation of the plot.

Option Explicit
' based on some code sample from web, don't recall URL
Const PI = 3.14159265
Dim byaLandscape(800, 255) As Integer ' can be single as well as long as DrawLandscape datasource type is changed too

Have you checked the exact name of the control in Access? If yes, have you then tried writing NTGraph3D0.Object instead of just NTGraph3D0 (or whatever your control`s name was) in the With line of the Torus example? Torus example with this .Object modification works fine in Access for me.