1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
int hits;
int[] viewPort = new int[4];
double x = (double) mous_x, y = (double) mous_y;
gl.glGetIntegerv(GL.GL_VIEWPORT, viewPort,0);
IntBuffer selectBuffer = Buffers.newDirectIntBuffer(512) ;
gl.glSelectBuffer(512, selectBuffer);
gl.glRenderMode(GL2.GL_SELECT);
gl.glInitNames();
gl.glPushName(0);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
glu.gluPickMatrix(x, (double) viewPort[3] - y, 3.0d, 3.0d, viewPort, 0);
glu.gluPerspective(50.0f, heightSave, 0.01, 10);
//camera et dessin
gl.glMatrixMode(GL2.GL_MODELVIEW);
glu.gluLookAt(0, 0, -translateZ, viseeX, viseeY, viseeZ, 0, 1, 0);
gl.glRotatef(rotateX, 0.0f, 1.0f, 0.0f);
gl.glRotatef(-rotateY, 1.0f, 0.0f, 0.0f);
scene(gLDrawable);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glPopName();
gl.glFlush();
hits = gl.glRenderMode(GL2.GL_RENDER);
processHits(hits, selectBuffer); |
Partager