How render voxels?

I start to learn how GVDB works and I try to render voxels on my own.
I generate topology like this:

gvdb1.Configure(3, 3, 3, 3, 5);
	gvdb1.SetChannelDefault(16, 16, 1);
	gvdb1.AddChannel(0, T_FLOAT, 1);

	float voxelSize = 0.4;

	gvdb1.SetVoxelSize(voxelSize, voxelSize, voxelSize);

	int m_numpnts = 250;
	Vector3DF* startPoint = new Vector3DF(0, 0, 0);

	for (int i = 0; i < m_numpnts; i++) {
		for (int j = 0; j < m_numpnts; j++) {
			for (int k = 0; k < m_numpnts; k++) {
				
				startPoint->x = i * voxelSize;
				startPoint->y = j * voxelSize;
				startPoint->z = k * voxelSize;

				gvdb1.ActivateSpace(*startPoint);
			}
		}
	}

	gvdb1.FinishTopology();
	gvdb1.UpdateAtlas();

And by using DrawTopology method in one of example I can see my topology.
How I can render voxels in those positions?

I’m having exactly the same problem. I am using gPointCloud as the starting point, but have changed the load_points method to just use gvdb.ActivateSpace(), and made a few other necessary changes to create the atlas correctly.

I have opted for this approach, as I am initially looking to compress a dense 3D matrix to a sparse .vbx format, and only want to store the active voxels. I think it is working, as the topology looks correct when I render it, and I get a reasonable level of compression, but I can’t seem to render the voxels.

It seems is necessary to use this code to render voxels (code from documentation):

gvdb.SetPoints ( pntpos, DataPtr(), pntclr );
int pntlen = 0, subcell = 4;
gvdb.InsertPointsSubcell ( subcell, numpnts, radius*2, origin,
pntlen);
gvdb.GatherLevelSet ( subcell, numpnts, radius, origin,
pntlen, 0, 1 );

but I don’t figure out how to use it

I’m also wondering how to render voxels. I reduced gInteractiveGL to what I think might be close to the minimum code needed to render a 200x200x200 cube. I get an all-black window. Here’s my code:

#include "gvdb.h"			
using namespace nvdb;

#include "main.h"			// window system 
#include <GL/glew.h>


VolumeGVDB	gvdb;

class Sample : public NVPWindow {
public:
	virtual bool init();
	virtual void display();

	int			gl_screen_tex;

};


bool Sample::init() 
{
	int w = getWidth(), h = getHeight();			// window width & height
	gl_screen_tex = -1;	

	gvdb.SetVerbose ( true );
	gvdb.SetCudaDevice ( GVDB_DEV_FIRST );
	gvdb.Initialize ();
	
	gvdb.Configure(0, 0, 3, 3, 5);
	gvdb.AddChannel(0, T_UCHAR, 1); //do i need this? i thought there was 1 channel by default, but when I take this out it doesn't work
	gvdb.SetChannelDefault ( 16, 16, 16 );

	for (int x = -100; x < 100; x++)
	{
		for (int y = -100; y < 100; y++)
		{
			for (int z = -100; z < 100; z++)
			{
				gvdb.ActivateSpace(Vector3DF(x, y, z));
			}
		}
	}
	gvdb.FinishTopology();
	gvdb.UpdateAtlas();

	Camera3D* cam = new Camera3D;						
	cam->setFov ( 50.0 );
	cam->setOrbit ( Vector3DF(20,30,0), Vector3DF(0,0,0), 700, 1.0 );	
	gvdb.getScene()->SetCamera( cam );
	
	Light* lgt = new Light;								
	lgt->setOrbit ( Vector3DF(299,57.3f,0), Vector3DF(132,-20,50), 200, 1.0 );
	gvdb.getScene()->SetLight ( 0, lgt );	

	nvprintf ( "Creating screen buffer. %d x %d\n", w, h );
	gvdb.AddRenderBuf ( 0, w, h, 4 );	

	createScreenQuadGL ( &gl_screen_tex, w, h );

	return true; 
}

void Sample::display() 
{
	gvdb.TimerStart ();
	gvdb.Render(SHADE_TRILINEAR, 0, 0);
	float rtime = gvdb.TimerStop();
	nvprintf ( "Render volume. %6.3f ms\n", rtime );

	gvdb.ReadRenderTexGL ( 0, gl_screen_tex );
	renderScreenQuadGL ( gl_screen_tex );

	postRedisplay();
}


int sample_main ( int argc, const char** argv ) 
{
	Sample sample_obj;
	return sample_obj.run ( "NVIDIA(R) GVDB Voxels - gInteractveGL", "intergl", argc, argv, 1024, 768, 4, 5 );
}

void sample_print( int argc, char const *argv)
{
}

Oh, I see GVDB_Programming_Guide.pdf has entire useful sections in it that GVDB_Programming_Guide_1.1.pdf doesn’t…such as SetPoints and CommitData. I’m still lost, though, I have no idea how to use these things or if I have to.

And in the following code in the documentation I have no idea what variables prefixed with “m_” are supposed to be…

// Allocate GPU and GPU memoryint numpnts;
DataPtr pntpos, pntclr;
gvdb.AllocData ( pntpos, numpnts, sizeof(Vector3DF), true);
gvdb.AllocData ( pntclr, numpnts, sizeof(uint), true);
// Get CPU pointers
Vector3DF* pos = (Vector3DF*) gvdb.getDataPtr( 0, pntpos );
uint* clr = (uint*) gvdb.getDataPtr( 0, pntclr );
// .. load points into CPU here ..
// Commit point data to GPU
gvdb.CommitData ( pntpos, m_numpnts, (char*) m_pntpos.cpu, 0, sizeof(Vector3DF) );
gvdb.CommitData ( pntclr, m_numpnts, (char*) m_pntclr.cpu, 0, sizeof(uint) );