viewer
Class GLViewer

java.lang.Object
  extended by viewer.GLViewer
All Implemented Interfaces:
java.util.EventListener, javax.media.opengl.GLEventListener

public class GLViewer
extends java.lang.Object
implements javax.media.opengl.GLEventListener

Displays the actual GL drawings and takes care of all GL needs for the viewer.

Author:
Henry Gross, Ed Williams

Field Summary
 Lights lights
           
 
Constructor Summary
GLViewer(Viewer viewer)
          create a new instance of GLViewer and set up some basic variables
 
Method Summary
 void changeBrightness(int i)
          Change the brightness of the lights
 void display(javax.media.opengl.GLAutoDrawable drawable)
          draw what we want to draw
 void displayChanged(javax.media.opengl.GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged)
           
 void draw()
          redraw the screen
 double[] getCam()
          returns the camera array
 javax.media.opengl.GLCanvas getCanvas()
           
 javax.media.opengl.GL getGL()
          Return the GL object
 boolean getTextureState()
          return if textures are on
 void init(javax.media.opengl.GLAutoDrawable drawable)
          initialize all of the GL stuff
 void requestFocus()
          request that the gl receives focus
 void reshape(javax.media.opengl.GLAutoDrawable drawable, int x, int y, int width, int height)
           
 void screenshot()
          take a screenshot have to do this messy hack because of glContexts not being active on threads or some such thing
 void set3D(boolean b)
          set whether to display in 3D or 2D
 void setCam(double[] cam)
          Sets the camera array to the the camera array gioven
 void setForceRenderNext(boolean f)
           
 void setFov(double fov)
          Set the field of vision to the specified angle
 void setLights(boolean b)
          turn lights on or off
 void setMap(Model map)
          set the internal map to the map that we want to view
 void setMapSameGL(Model map)
           
 void showTextures(boolean b)
          Set whether or not to display the textures
 void startGL()
          start all of the GL code this is seperate since we might want to do some setup before we actually do this
 void takeScreenshot()
          actually take a screenshot
 void updateLights(boolean b)
          we changed the lights, so update gl with the new lights
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lights

public Lights lights
Constructor Detail

GLViewer

public GLViewer(Viewer viewer)
create a new instance of GLViewer and set up some basic variables

Method Detail

setForceRenderNext

public void setForceRenderNext(boolean f)

getCanvas

public javax.media.opengl.GLCanvas getCanvas()
Returns:
GLVanvas the canvas to be added to the frame

setMap

public void setMap(Model map)
set the internal map to the map that we want to view

Parameters:
map - the map that we will be viewing

setMapSameGL

public void setMapSameGL(Model map)

startGL

public void startGL()
start all of the GL code this is seperate since we might want to do some setup before we actually do this


init

public void init(javax.media.opengl.GLAutoDrawable drawable)
initialize all of the GL stuff

Specified by:
init in interface javax.media.opengl.GLEventListener

display

public void display(javax.media.opengl.GLAutoDrawable drawable)
draw what we want to draw

Specified by:
display in interface javax.media.opengl.GLEventListener

displayChanged

public void displayChanged(javax.media.opengl.GLAutoDrawable drawable,
                           boolean modeChanged,
                           boolean deviceChanged)
Specified by:
displayChanged in interface javax.media.opengl.GLEventListener

reshape

public void reshape(javax.media.opengl.GLAutoDrawable drawable,
                    int x,
                    int y,
                    int width,
                    int height)
Specified by:
reshape in interface javax.media.opengl.GLEventListener

getCam

public double[] getCam()
returns the camera array

Returns:
the camera array

setCam

public void setCam(double[] cam)
Sets the camera array to the the camera array gioven

Parameters:
cam - the camera array to set the camera to

setFov

public void setFov(double fov)
Set the field of vision to the specified angle

Parameters:
fov - the fov angle we want

draw

public void draw()
redraw the screen


set3D

public void set3D(boolean b)
set whether to display in 3D or 2D

Parameters:
b - true if to display in 3D

showTextures

public void showTextures(boolean b)
Set whether or not to display the textures

Parameters:
b - true if we wnat to display textures

changeBrightness

public void changeBrightness(int i)
Change the brightness of the lights

Parameters:
i - the intensity of the lights

updateLights

public void updateLights(boolean b)
we changed the lights, so update gl with the new lights

Parameters:
b - true if we changed lights

setLights

public void setLights(boolean b)
turn lights on or off

Parameters:
b - true to turn lights on

getGL

public javax.media.opengl.GL getGL()
Return the GL object

Returns:
the gl object

requestFocus

public void requestFocus()
request that the gl receives focus


takeScreenshot

public void takeScreenshot()
actually take a screenshot


screenshot

public void screenshot()
take a screenshot have to do this messy hack because of glContexts not being active on threads or some such thing


getTextureState

public boolean getTextureState()
return if textures are on

Returns:
true is the textures are being displayed