Passing 3D POint in VB6

Hello,

Is it possible to setup a 3D point Array in VB 6 and pass it to an OpenGL Function.

For example I have setup the following Array:

Public Type Grid3D
x As GLfloat
y As GLfloat
z As GLfloat
End Type

Dim Grid3D1(3) As Grid3D
Grid3D1(0).x = XMin3D '-2#
Grid3D1(0).y = YMin3D '-2#
Grid3D1(0).z = ZCoord3D(0, 0) '0
Grid3D1(1).x = XMin3D
Grid3D1(1).y = YMax3D
Grid3D1(1).z = ZCoord3D(0, GlnRowCount - 1)
Grid3D1(2).x = XMax3D
Grid3D1(2).y = YMin3D
Grid3D1(2).z = ZCoord3D(GlnColumnCount - 1, 0)
Grid3D1(3).x = XMax3D
Grid3D1(3).y = YMax3D
Grid3D1(3).z = ZCoord3D(GlnColumnCount - 1, GlnRowCount - 1)

Now I want to pass to glMap2f to setup a grid
'Pass Control Points to OPenGL
glColor3f 1#, 1#, 1#
glEnable GL_MAP2_VERTEX_3
glMap2f GL_MAP2_VERTEX_3, XMin3D, XMax3D, 4, 2, YMin3D, YMax3D, 2 * 4, 2, Grid3D1(0)

'GridRows And Columns
glMapGrid2f RowCount, 0#, 1#, ColumnCount, 0#, 1#

'Render Grid
glEvalMesh2 GL_LINE, 0, RowCount, 0, ColumnCount

I get an error By Ref Arugument Mismatch.

If I pass a single variable Grid3d1(0).x I avoid the error but do not pass all the 3d points. There must be some other way to setup and pass a 3D point array in VB 6?
I am using VB OPenGL API Type Library ANSI for VB 6.

How is the glMap2f function declared in the type library?

Does glMap2f GL_MAP2_VERTEX_3, XMin3D, XMax3D, 4, 2, YMin3D, YMax3D, 2 * 4, 2, VarPtr(Grid3D1(0)) avoid the error?

How about glMap2f GL_MAP2_VERTEX_3, XMin3D, XMax3D, 4, 2, YMin3D, YMax3D, 2 * 4, 2, VarPtrArray(Grid3D1(0))?

I get the same error using VarPtrArray(Grid3D1(0))
Dim VarPtrArray() As GLfloat

glMap2f is declared as follows:

glMap2f(target As glMap2TargetConstants, u1 As GLfloat, u2 As GLfloat, ustride As GLint, uorder AS GLint, v1 As GLfloat, v2 As GLfloat, vstride As GLint, vorder As GLint, Points As GLfloat)

Doesn’t like the Points Array

I have tried Grid3D1(0), Grid3D1(x,y,z), Grid3D1, Grid3D. Always wants the specific variable type Grid3D1(0).x or Grid3D1(0).y or Grid3D1(0).z

I can’t find any type declaration in the VBGL type libary for 3D Point Arrays

Another method may work:

Public Type Grid3D
xyz(2) As GLfloat
End Type

Dim Grid3D1(3) As Grid3D
Grid3D1(0).xyz(0) = XMin3D
Grid3D1(0).xyz(1) = YMin3D
Grid3D1(0).xyz(2) = ZCoord3D(0, 0)
Grid3D1(1).xyz(0) = XMin3D
Grid3D1(1).xyz(1) = YMax3D
Grid3D1(1).xyz(2) = ZCoord3D(0, GlnRowCount - 1)
Grid3D1(2).xyz(0) = XMax3D
Grid3D1(2).xyz(1) = YMin3D
Grid3D1(2).xyz(2) = ZCoord3D(GlnColumnCount - 1, 0)
Grid3D1(3).xyz(0) = XMax3D
Grid3D1(3).xyz(1) = YMax3D
Grid3D1(3).xyz(2) = ZCoord3D(GlnColumnCount - 1, GlnRowCount - 1)

glMap2f GL_MAP2_VERTEX_3, XMin3D, XMax3D, 4, 2, YMin3D, YMax3D, 4, 2, Grid3D1(0).xyz(0)

I don’t get the mismatch error but I cant tell if the whole array is being passed or just one variable. Nothing is showing up in the window. Basically, all I want to do is setup and display a grid.