3D Picking

Hi,

I have attempted to implement the standard OpenGL picking algorithm for selecting a cuboid in a 3D scene. It doesn’t seem to be working - wherever in the scene I click, it returns hits = 2. I’ve been over this for hours now and can’t see what I’m doing wrong. Please help… (I’m using C# but all the openGL code is the same)

</font><blockquote><font size=“1” face=“Verdana, Arial”>code:</font><hr /><pre style=“font-size:x-small; font-family: monospace;”>

private static void Mouse(int button, int state, int x, int y) {

int[] selectBuffer = new int[BUFSIZE];
int hits;
int[] viewport = new int[4];

if(button != GLUT_LEFT_BUTTON

…my code seems to have disappeared from the previous attempt:

</font><blockquote><font size=“1” face=“Verdana, Arial”>code:</font><hr /><pre style=“font-size:x-small; font-family: monospace;”>

private static void Mouse(int button, int state, int x, int y) {

int[] selectBuffer = new int[BUFSIZE];
int hits;
int[] viewport = new int[4];

if(button != GLUT_LEFT_BUTTON

I don’t know why I can’t seem to post code… is the pipe separator illegal?

sometimes it chokes on ‘<’, and sometimes it seems to choke for no good reason. sometimes the margins get all out of whack. put simply, it’s a POS.

try deleting and posting again, or just posting again. it should take eventually.