Hi,
does anyone have an idea why my program crashes when I try to make glSelectBuffer - call. I’m trying to find out what object user has clicked on and the code uses glSelectBuffer to achieve this.
/* (non-Javadoc)
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
*/
public void mousePressed(MouseEvent e) {
System.out.println("MousePressed");
int x = e.getX();
int y = e.getY();
int objectsFound = 0; // This will hold the amount of objects clicked
int viewportCoords[] = new int [4]; // We need an array to hold view port coordinates
int selectBuffer[] = new int [32];
gl.glSelectBuffer(32, selectBuffer); // Setup selection buffer to accept object ID's. PROGRAM CRASHES IN HERE!
gl.glGetIntegerv(GL.GL_VIEWPORT, viewportCoords); // Get the current view port coordinates
gl.glMatrixMode(GL.GL_PROJECTION); // We want to now effect projection matrix
...