Picking Buffer always empty.

Started by Wavewash, January 05, 2006, 22:09:56

Previous topic - Next topic

Del

I changed
    //create 5x5 pixel picking region near cursor location 
             GLU.gluPickMatrix( (float) mouse_x, (float) mouse_y, 5.0f, 5.0f, viewport);


to
            //create 5x5 pixel picking region near cursor location 
            GLU.gluPickMatrix( (float) mouse_x, (float) mouse_y, 5.0f, 5.0f,IntBuffer.wrap(viewport));

To get the last example to work. It was either incorrect code before or a change in GLU.gluPickMatrix since the lastest lwjgl version?

Is this the correct way of solving this?

Thanks, Del

Edit -
Also, would this be a good way to detect what I've hit, in say a first person shooter if mouse x and y where just switch with the crosshair's x and y(center of screen in most cases)?

manji

Thank you all very much for your comments and source! They have been very helpful for me, and picking works like a charm now.

@Del: I had the same problem and the solution you gave suits me fine.
toyWars game blog: http://toywars.wordpress.com/