This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Any tips when using Scissor tests and glReadPixels to detect clicked areas ?

Greetings,

I'm trying to find different ways to detect which element was clicked on a rendered image with OpenGL ES 2.x.

It seems that the most common way to do this is to :

  • Apply a scissor test of a 1x1 rectangle at the clicked location
  • Redraw of the scene objects in a buffer, painting each object with a unique colour
  • Use glReadPixels on that buffer and infer the clicked element from its colour

Giving a "unique colour" to each object efficiently seems a bit tricky.

However, is there any trick to speed up this dummy redraw ? Given that fragments will only be displayed in a 1x1 area, does the buffer resolution matter ?

Is there any OES extension that could speed up this process even more ?