Create custom geometry in Using vray in Maya

Hi,
I would like to create a custom geometry with vray in maya (c++).
The only provided Maya samples, vraysphere and vrayplane, seem to use standard primitives.
How to create custom geometry generated on the fly in c++ ?

I tried to add a simple triangle in the compileGeometry function, but the setIntersectionData function never gets called upon rendering:

void compileGeometry(VR::VRayRenderer *vray, VR::TraceTransform *theTMs, double *times, int tmCount)
{
	BaseInstance::compileGeometry(vray, theTMs, times, tmCount);
  	rayCache.frameBegin(vray);
	VR::RayServerInterface2 *rayserver=vray->getRayServer();

        VR::Vector p[3];

        p[0].x=0; p[0].y=0; p[0].z=0;
        p[1].x=10; p[1].y=0; p[1].z=0;
        p[2].x=0; p[2].y=0; p[2].z=10;

        int addingTriangle=rayserver->storeStaticTriangle(static_cast<GeometryGenerator*>(this), rayserver->getNewRenderID(), p);
       // addingTriangle is equal to 1 after calling storeStaticTriangle.
}

What am I missing ?

Thanks !

There are a lot of other geometry plugins in the SDK. Even lights, for example vray_lightsphere pushes raw triangles into the ray server.