Class ViewportJOGL
- java.lang.Object
-
- jadex.extension.envsupport.observer.graphics.AbstractViewport
-
- jadex.extension.envsupport.observer.graphics.opengl.ViewportJOGL
-
- All Implemented Interfaces:
IViewport
public class ViewportJOGL extends AbstractViewport
OpenGL/JOGL-based Viewport. This viewport attempts to use OpenGL for drawing. Exceptions/Errors may be thrown if OpenGL cannot be linked, also be sure to test isValid() afterwards to verify the availability of necessary extensions.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jadex.extension.envsupport.observer.graphics.AbstractViewport
AbstractViewport.MouseController
-
-
Field Summary
-
Fields inherited from class jadex.extension.envsupport.observer.graphics.AbstractViewport
areaSize_, bgColor_, canvas_, drawObjects_, inversionFlag_, objectLayers_, objectList_, objShiftX_, objShiftY_, paddedSize_, perspective, pixPosition_, position_, postLayers_, preLayers_, preserveAR_, rendering, size_, spacecontroller
-
-
Constructor Summary
Constructors Constructor Description ViewportJOGL(IPerspective persp, java.lang.ClassLoader classloader)
Creates a new OpenGL-based viewport.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Disposes the Viewport.void
drawPrimitive(DrawableCombiner dc, Primitive primitive, java.lang.Object obj)
Draws a primitivejavax.media.opengl.GL
getContext()
Returns the current GL rendering context.java.lang.Integer
getDisplayList(java.lang.String listName)
Returns a previous generated display list or null if it doesn't existcom.sun.opengl.util.j2d.TextRenderer
getTextRenderer(java.awt.Font font)
Returns an appropriate text renderer.int
getTexture(javax.media.opengl.GL gl, java.lang.String path)
Returns a texture.boolean
isValid()
Verifies the OpenGL context is valid and useable.void
refresh()
Refreshes the viewport.void
setDisplayList(java.lang.String listName, java.lang.Integer list)
Sets a display list.void
setSize(IVector2 size)
Sets the size of the display area.-
Methods inherited from class jadex.extension.envsupport.observer.graphics.AbstractViewport
addViewportListener, getAreaSize, getCanvas, getCanvasSize, getClippingBox, getInvertX, getInvertY, getObjectShift, getPaddedSize, getPerspective, getPixelSize, getPosition, getSize, getSpaceController, getSpaceController, getWorldCoordinates, isShowing, refreshCanvasSize, removeViewportListener, setAreaSize, setBackground, setInvertX, setInvertY, setObjectList, setObjectShift, setPosition, setPostLayers, setPreLayers, setPreserveAspectRation, setZoomLimit
-
-
-
-
Constructor Detail
-
ViewportJOGL
public ViewportJOGL(IPerspective persp, java.lang.ClassLoader classloader)
Creates a new OpenGL-based viewport. May throw UnsatisfiedLinkError and RuntimeException if linking to OpenGL fails.- Parameters:
layerObject
- object holding properties for pre/postlayerslibService
- library service for loading resources.
-
-
Method Detail
-
setSize
public void setSize(IVector2 size)
Description copied from class:AbstractViewport
Sets the size of the display area.- Specified by:
setSize
in interfaceIViewport
- Overrides:
setSize
in classAbstractViewport
- Parameters:
size
- size of the display area, may be padded to preserve aspect ratio
-
refresh
public void refresh()
Description copied from interface:IViewport
Refreshes the viewport.
-
isValid
public boolean isValid()
Verifies the OpenGL context is valid and useable.
-
getTexture
public int getTexture(javax.media.opengl.GL gl, java.lang.String path)
Returns a texture.- Parameters:
gl
- OpenGL interfacepath
- resource path of the texture- Returns:
- the texture
-
getTextRenderer
public com.sun.opengl.util.j2d.TextRenderer getTextRenderer(java.awt.Font font)
Returns an appropriate text renderer.- Parameters:
font
- the font for the renderer- Returns:
- the renderer
-
getDisplayList
public java.lang.Integer getDisplayList(java.lang.String listName)
Returns a previous generated display list or null if it doesn't exist- Parameters:
listName
- name of the list- Returns:
- previously generated display list
-
setDisplayList
public void setDisplayList(java.lang.String listName, java.lang.Integer list)
Sets a display list.- Parameters:
listName
- name of the listlist
- the display list
-
getContext
public javax.media.opengl.GL getContext()
Returns the current GL rendering context.- Returns:
- GL context, null if none is available
-
drawPrimitive
public void drawPrimitive(DrawableCombiner dc, Primitive primitive, java.lang.Object obj)
Draws a primitive- Parameters:
dc
- The combiner.primitive
- The primitive.obj
- The object being drawn.
-
dispose
public void dispose()
Disposes the Viewport.
-
-