de.javagl.swogl.rendering
Class PickingRayComputerShaderJOGL

java.lang.Object
  extended by de.javagl.swogl.rendering.PickingRayComputerShaderJOGL
All Implemented Interfaces:
de.javagl.swogl.PickingRayComputer

public class PickingRayComputerShaderJOGL
extends java.lang.Object
implements de.javagl.swogl.PickingRayComputer

Implementation of a PickingRayComputer that obtains the information required for picking from the viewport and modelview and projection matrix of JOGL.

This implementation requires the current GL object to work. This GL object should be set by calling setGL(GL3) in the GLEventListener#init(GLDrawable) method of JOGL.
Note that, in order to make this PickingRayComputer work properly, the update(Matrix4f, Matrix4f) method has to be called with the current camera- and projection matrix during each rendering pass.


Constructor Summary
PickingRayComputerShaderJOGL()
          Creates a new PickingRayComputerShaderJOGL
 
Method Summary
 de.javagl.swogl.geometry.Ray computePickingRay(int x, int y)
           
 void setGL(javax.media.opengl.GL3 gl)
          Set the current GL
 void update(javax.vecmath.Matrix4f cameraMatrix, javax.vecmath.Matrix4f projectionMatrix)
          Update this picking ray computer with the given camera- and projection matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PickingRayComputerShaderJOGL

public PickingRayComputerShaderJOGL()
Creates a new PickingRayComputerShaderJOGL

Method Detail

setGL

public void setGL(javax.media.opengl.GL3 gl)
Set the current GL

Parameters:
gl - The GL

update

public void update(javax.vecmath.Matrix4f cameraMatrix,
                   javax.vecmath.Matrix4f projectionMatrix)
Update this picking ray computer with the given camera- and projection matrix. This method should be called during each rendering pass, on the rendering thread.

Parameters:
cameraMatrix - The camera matrix (i.e. the inverse of the view matrix)
projectionMatrix - The projection matrix

computePickingRay

public de.javagl.swogl.geometry.Ray computePickingRay(int x,
                                                      int y)
Specified by:
computePickingRay in interface de.javagl.swogl.PickingRayComputer