Phil 3.8.12

7:30 – 11:00 VISIBILITY

  • Demo prep. See Mike’s notes for more detail

11:00 – 4:00 FP

  • Now that I have the pick matrix worked out, I’m going to see how to ask the pipeline if any pixels have been drawn. Also need to see how to prevent the test drawing from going to the render buffer
  • Generating query indices and deleting them in cleanup()
  • Added a pickRender()  and pickResult() method to DrawableObject
  • Picking works, but seems to slow down the display. Also, GL_QUERY_RESULT_AVAILABLE always returns zero, even if there is a result. And just to make things a little weirder, the call glGetQueryObjectiv(drawQuery, GL_QUERY_RESULT_AVAILABLE, &result) does not slow down the display, but the following almost identical call glGetQueryObjectiv(drawQuery, GL_QUERY_RESULT, &result) does. No ideas about this right now.

 

Here’s the code in question

static enum TRANSFORM_MODE{UNAVAILABLE, HIT, MISS};
TRANSFORM_MODE pickResult(){
	GLint result;

	glGetQueryObjectiv(drawQuery, GL_QUERY_RESULT_AVAILABLE, &result);
	if(result == 0)
		return UNAVAILABLE; // always returns this

	glGetQueryObjectiv(drawQuery, GL_QUERY_RESULT, &result); // slows down rendering once called.
	if(result)
		return HIT;
	else
		return MISS;
};