Oops, didn't realize this post was in the OpenGL forum!! I came from the "New Content" page. My bad. Looks like you managed to find the equivalent OpenGL interface, though.
I'm not 100% sure what's wrong with your code, being that it's OpenGL, but my guess would be that you're putting the glBeginQuery and glEndQuery calls inside the glBegin/glEnd. No draw call actually gets made when you call glVertex3fv, so the query doesn't have anything to query. Also, with what you've written it looks like you're trying to query the number of samples that got draw for each triangle in the sphere, which I don't think is what you originally wanted to do. I would try something more like this:
#define NUM_VERT 20
GLUint oq_verts[NUM_VERT];
glGenQueriesARB(NUM_VERT, oq_verts);
// render the sphere normally first, however you like
DrawSphere();
// now query each vertex by attempting to draw a single point at that
// vertex's location. if any samples pass, then that vert is visible
// note that any verts obscured by the object itself will have zero samples
// that pass. this may or may not be what you intended! also, if your depth
// compare function is "less" then you may have to scooch your verts closer to
// the camera a little bit
for (int i = 0; i < NUM_VERT; i++) {
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, oq_verts[i]);
glBegin(GL_POINTS);
glVertex3fv(&vdata[i]);
glEnd();
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
}