   Why does my occlusion test always return TRUE ?
  Hello !I have a small problem with HP_OCCLUSION_TEST. It return always TRUE, whatever I do. I think that I'm doing right, so perhaps that is my fglrx driver (ATI, on linux) that don't support it ?? :/I hope someone could help me. Here is my code :>>>>>GLboolean result = 0;glDepthMask(GL_FALSE);glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);glEnable(GL_OCCLUSION_TEST_HP);glBegin(GL_POINTS);glVertex3f(0, 0, 0);glEnd();glDepthMask(GL_TRUE);glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result);glDisable(GL_OCCLUSION_TEST_HP);printf("%d\n", result);<<<<<So no matter where I look, result is TRUE :( Does anybody know, or could test this code with nVidia or on Windows ? Thank you...Olivier[Edited by - keo on May 29, 2006 2:30:18 PM]
  HP_OCCLUSION_TEST is + has been replace with ARB_occlusion_test or someitsee the nvidia developer website for a demo   ;  I also try it, here is my code :GLuint queries = 0;GLuint sampleCount;glGenQueriesARB(1, &queries);glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);glDisable(GL_BLEND);glDisable(GL_STENCIL_TEST);glBeginQueryARB(GL_SAMPLES_PASSED_ARB, queries);glBegin(GL_POINTS);glVertex3f(0.0f, 0.0f, 0.0f);glEnd();glEndQueryARB(GL_SAMPLES_PASSED_ARB);glEnable(GL_BLEND);glEnable(GL_STENCIL_TEST);glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);glGetQueryObjectuivARB(queries, GL_QUERY_RESULT_ARB, &sampleCount);if (sampleCount <= 0){printf("hidden\n");return;}printf("visible\n");(taken from the sgi documentation)It return always "visible", so I have the same problem that with HP_OCCLUSION_TEST :/But there is a thing that I don't understand : it return "visible", but sampleCount is always == -1. In the test "if (sampleCount <= 0)", how an unsigned integer can be less than zero ?Thanks...   ;Quote:Original post by keoI also try it, here is my code :An unsigned integer cannot be less than zero. So the line ...if(sampleCount <= 0)...will always return true. Unless you have missed a global decleration of sampleCount?   ;Quote:Original post by MoominAn unsigned integer cannot be less than zero. So the line ...if(sampleCount <= 0)...will always return true. Unless you have missed a global decleration of sampleCount?But it can be equal to zero, finally it don't change the problem. The original code is here : http://icps.u-strasbg.fr/~marchesin/perso/extensions/ARB/occlusion_query.html :GLuint sampleCount;...glGetQueryObjectuivARB(queries, GL_QUERY_RESULT_ARB, &sampleCount);if (sampleCount > 0) {// render object i};  in your new code you don't disable the z-buffer, as data is still writen thus the count is going to be > 0   ;Quote:Original post by phantomin your new code you don't disable the z-buffer, as data is still writen thus the count is going to be > 0unfortunately it don't change anything :(;  have u looked at the nvidia demo (with source)occlusion testing is relativly straight forward, ive had no problems (driver bugs aside)also u might wanna first check to see if the result is available first before u callglGetQueryObjectuivARB(queries, GL_QUERY_RESULT_ARB, &sampleCount);   ;  zedzeek,I use two consecutive frames, the first to do the occlusion query, the second to read the result (if available). But the test always return -1.I also test the nVidia demo : http://download.nvidia.com/developer/SDK/Individual_Samples/DEMOS/OpenGL/occlusion_query.zip. I have the same results !! The occlusion test for both the sphere and the plane return always -1 too. Could you test it? :-SI definitively despair.(sry for the basic english);  it works for metry posting the results u get from glGetString( GL_VENDOR )and what card + driver u have   