render.jogl
Class JoglRenderer

java.lang.Object
  extended byrender.Renderer
      extended byrender.jogl.JoglRenderer

public class JoglRenderer
extends Renderer

JOGL version of the software renderer, instead of drawing triangles into the buffer, we just push triangles into the graphics card.


Field Summary
 int DEBUG
           
static int DEBUG_NEW_LIGHTS
           
static int DEBUG_PICKING
           
static int DEBUG_TEXTURE
           
static int DEBUG_VERBOSE
           
 net.java.games.jogl.GLDrawable drawable
           
 net.java.games.jogl.GL gl
           
 net.java.games.jogl.GLU glu
           
 net.java.games.jogl.util.GLUT glut
           
static boolean printError
           
 
Fields inherited from class render.Renderer
bufferg, isAnaglyph, isHeadsUp, lod, manualCameraControl, seeMesh, showMesh, tableMode, updateTransparency
 
Constructor Summary
JoglRenderer()
           
 
Method Summary
 void addLight(double x, double y, double z, double lR, double lG, double lB)
          Add a light source where x,y,z are light source direction; r,g,b are light source color.
 Geometry getGeometry(int x, int y)
          Overloads the Renderer method to get a geometry, in our case this has to be called in the display thread, but our event handler system takes care of that.
 net.java.games.jogl.GL getGL()
           
 net.java.games.jogl.GLU getGLU()
           
 net.java.games.jogl.util.GLUT getGLUT()
           
 boolean getPoint(int x, int y, double[] xyz)
          get the coordinates of a point in world coordinates and put them into xyz if we did not hit anything, returns false this method also has to be called during the display thread.
 int[] init(int w, int h)
          Initializes the renderer.
 void render()
          Render the entire world for this frame.
 void setBgColor(double r, double g, double b)
          Set the background fill color.
 void setGLAmbient(float r, float g, float b)
           
 
Methods inherited from class render.Renderer
colorLight, getBgColor, getCamera, getCameraAim, getCameraPos, getCameraUp, getClippingPlaneEpsilon, getCx, getCy, getFL, getFOV, getGeometryBuffer, getH, getLod, getNumberOfLights, getOutline, getPoint, getPoint, getW, getWorld, headsUp, isDragging, isFixedLightPositions, lookAt, outline, placeLight, projectPoint, refresh, renderVertex, renderVertex, rotateView, setBgColor, setCamera, setCamera, setCameraAim, setCameraPos, setCameraUp, setClippingPlaneEpsilon, setCx, setCy, setDragging, setFixedLightPositions, setFL, setFOV, setGeometryBuffer, setH, setLod, setW, xf
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

printError

public static boolean printError

DEBUG_NEW_LIGHTS

public static final int DEBUG_NEW_LIGHTS
See Also:
Constant Field Values

DEBUG_PICKING

public static final int DEBUG_PICKING
See Also:
Constant Field Values

DEBUG_TEXTURE

public static final int DEBUG_TEXTURE
See Also:
Constant Field Values

DEBUG_VERBOSE

public static final int DEBUG_VERBOSE
See Also:
Constant Field Values

DEBUG

public int DEBUG

gl

public net.java.games.jogl.GL gl

glu

public net.java.games.jogl.GLU glu

glut

public net.java.games.jogl.util.GLUT glut

drawable

public net.java.games.jogl.GLDrawable drawable
Constructor Detail

JoglRenderer

public JoglRenderer()
Method Detail

getGL

public net.java.games.jogl.GL getGL()

getGLU

public net.java.games.jogl.GLU getGLU()

getGLUT

public net.java.games.jogl.util.GLUT getGLUT()

setGLAmbient

public void setGLAmbient(float r,
                         float g,
                         float b)

init

public int[] init(int w,
                  int h)
Description copied from class: Renderer
Initializes the renderer.

Overrides:
init in class Renderer
Parameters:
w - framebuffer width
h - framebuffer height.
Returns:
framebuffer array.

addLight

public void addLight(double x,
                     double y,
                     double z,
                     double lR,
                     double lG,
                     double lB)
Description copied from class: Renderer
Add a light source where x,y,z are light source direction; r,g,b are light source color.

Overrides:
addLight in class Renderer

setBgColor

public void setBgColor(double r,
                       double g,
                       double b)
Description copied from class: Renderer
Set the background fill color.

Overrides:
setBgColor in class Renderer

render

public void render()
Description copied from class: Renderer
Render the entire world for this frame.

Overrides:
render in class Renderer

getGeometry

public Geometry getGeometry(int x,
                            int y)
Overloads the Renderer method to get a geometry, in our case this has to be called in the display thread, but our event handler system takes care of that.

Overrides:
getGeometry in class Renderer
Parameters:
x - x coordinate in the image
y - y coordinate in the image
Returns:
the geometry of the foremost object at that location

getPoint

public boolean getPoint(int x,
                        int y,
                        double[] xyz)
get the coordinates of a point in world coordinates and put them into xyz if we did not hit anything, returns false this method also has to be called during the display thread. Our event system handles this. Because of floating point error due to the way the points are saved in hardware, the result may not be totally correct (ie, if we expect z to be 0, we will get z to be close to 0 within an error rate which I have not calculated yet). Also this works currently with the default software renderer camera calculation It should not work with when you are doing user camera movement (may actually just need to remove one line).

Overrides:
getPoint in class Renderer