Hello Guest

Picking Buffer always empty.

  • 16 Replies
  • 22282 Views
*

Offline Del

  • *
  • 6
Re: Picking Buffer always empty.
« Reply #15 on: February 24, 2009, 10:26:12 »
I changed
Code: [Select]
    //create 5x5 pixel picking region near cursor location
             GLU.gluPickMatrix( (float) mouse_x, (float) mouse_y, 5.0f, 5.0f, viewport);

to
Code: [Select]
            //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)?
« Last Edit: February 24, 2009, 10:38:22 by Del »

*

Offline manji

  • *
  • 41
    • toyWars
Re: Picking Buffer always empty.
« Reply #16 on: April 29, 2009, 10:32:44 »
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.