Like in topic. I want to make very accurate collision system, so I'm trying to use pixel perfect collision. I think I tried to find a solution almost everywhere, but I haven't found any satisfactory solution. I am writing in Java.

This is my current algorithm:

Code :
protected boolean accurateTest(int object1, int object2) {
        glStencilFunc(GL_ALWAYS, 1, 1);
        glStencilFunc(GL_EQUAL, 1, 1);
        glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
        glBeginQuery(GL_SAMPLES_PASSED, occquery);
        do {
            glGetQueryObject(occquery, GL_QUERY_RESULT_AVAILABLE, samples);
        } while (samples.get(0) == 0);
        glGetQueryObject(occquery, GL_QUERY_RESULT, samples);
        return samples.get(0) > 0;

This algorithm works well, but it has one very big drawback - I can only specify the number of pixels that have collided, but not collision coordinates. Outside that, I'm not sure this will work outside screen.

Now the question - is it possible to make pixel perfect collision (or at least very accurate collision detection for irregular shapes) and get coordinates of pixel(s) that have collided? If yes, I would be very grateful if someone will give a link to examples or show how can I handle this problem.