Problems using GLTexImage3D correctly

This is how I give the Bitmaps to OpenGL. (C#)

public static int Generate3DTexture( string[] names ) // file paths
    //basically merging the images into one vertical column of images
    MagickImageCollection allimages = new MagickImageCollection();
    foreach (string eachname in names)
        allimages.Add(new MagickImage(eachname));
    MagickImage template = new MagickImage(MagickColor.FromRgba(0, 0, 0, 0), MasterSize.Width, MasterSize.Height * names.Length);
    Point drawpnt = new Point(0, 0);
    foreach (MagickImage each in allimages)
        template.Composite(each, drawpnt.X, drawpnt.Y, CompositeOperator.Overlay);
        drawpnt.Y += each.Height;
    Bitmap merged = template.ToBitmap();
    //saving the bitmap here is confirmed to stack them vertically
    BitmapData thedata = merged.LockBits(new Rectangle(new Point(0, 0), merged.Size), ImageLockMode.ReadOnly, WfPixelFormat.Format32bppArgb);
    int texId = GL.GenTexture();
    GL.BindTexture(TextureTarget.Texture3D, texId);
    GL.TexImage3D(TextureTarget.Texture3D, 0, PixelInternalFormat.Rgba, MasterSize.Width, MasterSize.Height, names.Length, 0, GlPixelFormat.Bgra, PixelType.UnsignedByte, thedata.Scan0);
    GL.BindTexture(TextureTarget.Texture3D, 0);
    return texId;

I found a description for how the data should be organized here, which I interpreted to mean the images should be arranged vertically, and possibly flipped or something.

So for my test I used 2 images, on the fragment shader I apply the texture like so:

void main()
    outputColor =  texture3D(ThreeDTexture,vec3(texcoord.x, 1.0 - texcoord.y, 0));

The result is the two images merged in roughly equal proportions. That’s what I would expect if I made the vec3.z parameter 0.5. So I tried it with three images. It gives a 50-50 combination of the first and last images supplied (?!?!). This is it’s behavior I get without regard to the value I give for vec3.z

I expected that parameter to be the Z axis for the images supplied. Or if I used whole numbers for it to be an index for the array of images supplied.

Where did I go wrong?

What I’m giving to OpenGL (in order):

What I'm giving to OpenGL

The result:

The result.

All topic