OpenGL conditional rendering bug on MacOS X
At least on Intel HD4000 GPUs there seems to be a bug regarding conditional rendering in OpenGL on 10.8 Mountain Lion: After the conditional rendering the condition state (ignore draw calls or execute them) is ‘stuck’ until the next draw call gets issued – this can ignore glClear calls which shouldn’t get ignored.
Here’s an example:
GLuint query; glGenQueries(1, &query); glBeginQuery(GL_SAMPLES_PASSED, query); // draw bounding box glEndQuery(GL_SAMPLES_PASSED); glBeginConditionalRender( query, GL_QUERY_WAIT ); // draw actual object: if no sample of the draw call above was // drawn, all glClear and draw commands will get ignored glEndConditionalRender(); // now everything should get drawn again! glClear( GL_COLOR_BUFFER_BIT ); // might also get ignored -> BUG glDrawArrays(...); glClear( ... ); // now it works again
To be clear, glClear and glClearBuffer commands between glBeginConditionalRender and glEndConditionalRender should get ignored if the query failed, but after glEndConditionalRender everything should be back to normal. In fact at least on the stated configuration (10.8, Intel HD4000) it isn’t, the state of ignoring the glClear calls is stuck until the next draw call gets issued (which works as intended btw.). On 10.7 with a GeForce 9600M it works as intended, so I’m not sure whether this is a bug of the Intel drivers or of 10.8.
The bug is listed under bug id #12949224 and joins the list of other open issues.