ATI Radeon and NV occlusion query

Hello,

again I have a strange problem: The result of NV_occlusion_queries sometimes don’t return in finite time (Radeon 9700, Windows XP). Take a look at this snippet of code:

glGenOcclusionQueriesNV(1,&occl);
glBeginOcclusionQueryNV(occl);

glBegin(GL_TRIANGLE_STRIP);
glVertex3f(stack_x,0,0.5);
glVertex3f(stack_x,stack_y,0.5);
glVertex3f(0,0,0.5);
glVertex3f(0,stack_y,0.5);
glEnd();

glEndOcclusionQueryNV();

GLuint result;
glFlush(); 
glFinish();
do glGetOcclusionQueryuivNV(occl,GL_PIXEL_COUNT_AVAILABLE_NV,&result); 
    while (result==GL_FALSE);
glGetOcclusionQueryuivNV(occl,GL_PIXEL_COUNT_NV,&result);

The first GetOcclusionQuery never returns GL_TRUE, although I even explicitly flushed the pipeline before. If I remove the first check and directly proceed to the pixel count, this function hangs.

When I first got this problem in another part of my code, I installed the latest drivers and everyting worked perfectly. Now it happens again here, and I don’t know what could have caused it. Any ideas?

[This message has been edited by phlucas (edited 03-31-2003).]