org.osm2world.core.target.jogl
Class JOGLTarget

Object
  extended by AbstractTarget<R>
      extended by PrimitiveTarget<RenderableToJOGL>
          extended by JOGLTarget
All Implemented Interfaces:
Target<RenderableToJOGL>

public final class JOGLTarget
extends PrimitiveTarget<RenderableToJOGL>


Field Summary
static int MAX_TEXTURE_LAYERS
          maximum number of texture layers any material can use
 
Fields inherited from class AbstractTarget
BOX_TEX_COORDS_1, BOX_TEX_COORDS_2
 
Constructor Summary
JOGLTarget(GL2 gl, JOGLRenderingParameters renderingParameters, GlobalLightingParameters globalLightingParameters)
          creates a new JOGLTarget for a given GL2 interface.
 
Method Summary
static void clearGL(GL2 gl, Color clearColor)
          clears the rendering surface and the z buffer
static void drawBackgoundImage(GL2 gl, File backgroundImage, int startPixelX, int startPixelY, int pixelWidth, int pixelHeight, JOGLTextureManager textureManager)
           
 void drawLineLoop(Color color, int width, List<VectorXYZ> vs)
           
 void drawLineStrip(Color color, int width, List<VectorXYZ> vs)
           
 void drawLineStrip(Color color, int width, VectorXYZ... vs)
           
 void drawPoints(Color color, VectorXYZ... vs)
           
static void drawPrimitive(GL2 gl, int glPrimitiveType, List<VectorXYZ> vertices, List<VectorXYZ> normals, List<List<VectorXZ>> texCoordLists)
           
protected  void drawPrimitive(Primitive.Type type, Material material, List<VectorXYZ> vertices, List<VectorXYZ> normals, List<List<VectorXZ>> texCoordLists)
           
static void drawText(String string, int x, int y, int screenWidth, int screenHeight, Color color)
           
static void drawText(String string, Vector3D pos, Color color)
           
 void finish()
          prepares a scene, based on the accumulated draw calls, for rendering.
 void freeResources()
           
 Class<RenderableToJOGL> getRenderableType()
          returns the renderable type designed for this target
 boolean isFinished()
           
 void render(Camera camera, Projection projection)
           
 void render(RenderableToJOGL renderable)
          renders a renderable object to this target.
 void renderPart(Camera camera, Projection projection, double xStart, double xEnd, double yStart, double yEnd)
          similar to render(Camera, Projection), but allows rendering only a part of the "normal" image.
 void reset()
          discards all accumulated draw calls
 void setConfiguration(Configuration config)
           
 void setGlobalLightingParameters(GlobalLightingParameters parameters)
          set global lighting parameters.
 void setRenderingParameters(JOGLRenderingParameters renderingParameters)
          set global rendering parameters.
 
Methods inherited from class PrimitiveTarget
drawTriangleFan, drawTriangles, drawTriangleStrip, drawTrianglesWithNormals
 
Methods inherited from class AbstractTarget
beginObject, drawBox, drawColumn, drawConvexPolygon
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_TEXTURE_LAYERS

public static final int MAX_TEXTURE_LAYERS
maximum number of texture layers any material can use

See Also:
Constant Field Values
Constructor Detail

JOGLTarget

public JOGLTarget(GL2 gl,
                  JOGLRenderingParameters renderingParameters,
                  GlobalLightingParameters globalLightingParameters)
creates a new JOGLTarget for a given GL2 interface. It is possible to have multiple targets that render to the same gl object.

Parameters:
renderingParameters - global parameters for rendering; see setRenderingParameters(JOGLRenderingParameters)
globalLightingParameters - global parameters for lighting; see setGlobalLightingParameters(GlobalLightingParameters)
Method Detail

getRenderableType

public Class<RenderableToJOGL> getRenderableType()
Description copied from interface: Target
returns the renderable type designed for this target


reset

public void reset()
discards all accumulated draw calls


render

public void render(RenderableToJOGL renderable)
Description copied from interface: Target
renders a renderable object to this target. Usually, this means calling a "renderTo" method on that renderable, with this target as a parameter.


drawPrimitive

protected void drawPrimitive(Primitive.Type type,
                             Material material,
                             List<VectorXYZ> vertices,
                             List<VectorXYZ> normals,
                             List<List<VectorXZ>> texCoordLists)
Specified by:
drawPrimitive in class PrimitiveTarget<RenderableToJOGL>
vertices - vertices that form the primitive
normals - normal vector for each vertex; same size as vs
texCoordLists - texture coordinates for each texture layer, each list has the same size as vs

drawPrimitive

public static void drawPrimitive(GL2 gl,
                                 int glPrimitiveType,
                                 List<VectorXYZ> vertices,
                                 List<VectorXYZ> normals,
                                 List<List<VectorXZ>> texCoordLists)

drawPoints

public void drawPoints(Color color,
                       VectorXYZ... vs)

drawLineStrip

public void drawLineStrip(Color color,
                          int width,
                          VectorXYZ... vs)

drawLineStrip

public void drawLineStrip(Color color,
                          int width,
                          List<VectorXYZ> vs)

drawLineLoop

public void drawLineLoop(Color color,
                         int width,
                         List<VectorXYZ> vs)

setGlobalLightingParameters

public void setGlobalLightingParameters(GlobalLightingParameters parameters)
set global lighting parameters. Using this method affects all primitives (even those from previous draw calls).

Parameters:
parameters - parameter object; null disables lighting

setRenderingParameters

public void setRenderingParameters(JOGLRenderingParameters renderingParameters)
set global rendering parameters. Using this method affects all primitives (even those from previous draw calls).


setConfiguration

public void setConfiguration(Configuration config)
Specified by:
setConfiguration in interface Target<RenderableToJOGL>
Overrides:
setConfiguration in class AbstractTarget<RenderableToJOGL>

finish

public void finish()
prepares a scene, based on the accumulated draw calls, for rendering.

Specified by:
finish in interface Target<RenderableToJOGL>
Overrides:
finish in class AbstractTarget<RenderableToJOGL>

isFinished

public boolean isFinished()

render

public void render(Camera camera,
                   Projection projection)

renderPart

public void renderPart(Camera camera,
                       Projection projection,
                       double xStart,
                       double xEnd,
                       double yStart,
                       double yEnd)
similar to render(Camera, Projection), but allows rendering only a part of the "normal" image. For example, with xStart=0, xEnd=0.5, yStart=0 and yEnd=1, only the left half of the full image will be rendered, but it will be stretched to cover the available space. Only supported for orthographic projections!


freeResources

public void freeResources()

clearGL

public static final void clearGL(GL2 gl,
                                 Color clearColor)
clears the rendering surface and the z buffer

Parameters:
clearColor - background color before rendering any primitives; null uses a previously defined clear color

drawText

public static final void drawText(String string,
                                  Vector3D pos,
                                  Color color)

drawText

public static final void drawText(String string,
                                  int x,
                                  int y,
                                  int screenWidth,
                                  int screenHeight,
                                  Color color)

drawBackgoundImage

public static final void drawBackgoundImage(GL2 gl,
                                            File backgroundImage,
                                            int startPixelX,
                                            int startPixelY,
                                            int pixelWidth,
                                            int pixelHeight,
                                            JOGLTextureManager textureManager)