de.grogra.imp3d.gl
public class GLDisplay extends ViewComponentAdapter implements javax.media.opengl.GLEventListener, RenderState, java.awt.image.ImageObserver, Selectable
| Modifier and Type | Field and Description |
|---|---|
protected int |
dlSupershape
Display list number for supershapes.
|
Pool |
pool |
static Type |
RENDER_MODE |
DISPOSED, DISPOSING, RENDERED_IMAGE, RENDERING, REPAINT_MASKCURRENT_HIGHLIGHTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHALL, CHANGED, MIN_USER_FLAG, SCENE, SELECTION, TOOLS| Constructor and Description |
|---|
GLDisplay() |
| Modifier and Type | Method and Description |
|---|---|
void |
display(javax.media.opengl.GLAutoDrawable d) |
void |
displayChanged(javax.media.opengl.GLAutoDrawable d,
boolean modeChanged,
boolean deviceChanged) |
void |
dispose() |
void |
drawBox(float halfWidth,
float halfLength,
float height,
Shader s,
int highlight,
Matrix4d t)
Draw a box from -axis to +axis using the transformation matrix t.
|
void |
drawFrustum(float length,
float baseRadius,
float topRadius,
boolean baseClosed,
boolean topClosed,
float scaleV,
Shader s,
int highlight,
Matrix4d t)
Can be used to draw cylinders and the like.
|
void |
drawFrustumIrregular(float length,
int sectorCount,
float[] baseRadii,
float[] topRadii,
boolean baseClosed,
boolean topclosed,
float scaleV,
Shader s,
int highlight,
Matrix4d t) |
void |
drawLamella(float halfWidth,
float halfLength,
float height,
float a,
float b,
Shader s,
int highlight,
Matrix4d t) |
void |
drawLine(Tuple3f origin,
Tuple3f end,
Tuple3f color,
int highlight,
Matrix4d t)
Connect the two points with a line and apply the transformation matrix.
|
void |
drawParallelogram(float length,
Vector3f axis,
float scaleU,
float scaleV,
Shader s,
int highlight,
Matrix4d t) |
void |
drawPlane(Shader s,
int highlight,
Matrix4d t)
Draw an x/y plane.
|
void |
drawPoint(Tuple3f origin,
int pixelSize,
Tuple3f color,
int highlight,
Matrix4d t)
Draw a single point with the specified pixel size and color.
|
void |
drawPointCloud(float[] locations,
float pointSize,
Tuple3f color,
int highlight,
Matrix4d t)
Draw a set of points.
|
void |
drawPolygons(Polygonizable pz,
java.lang.Object obj,
boolean asNode,
Shader s,
int highlight,
Matrix4d t) |
void |
drawPrismRectangular(float y,
float xPos,
float xNeg,
float zPos,
float zNeg,
int highlight,
Matrix4d t) |
void |
drawRectangle(int x,
int y,
int w,
int h,
Tuple3f color)
Draw a rectangle from (x/y) to (x+w/y+h) with the specified color.
|
void |
drawSphere(float radius,
Shader s,
int highlight,
Matrix4d t)
Draw a sphere with the specified radius around the origin (0/0/0).
|
void |
drawString(int x,
int y,
java.lang.String text,
java.awt.Font font,
Tuple3f color)
Draw a string with the selected font and color at location (x/y).
|
void |
drawSupershape(float a,
float b,
float m1,
float n11,
float n12,
float n13,
float m2,
float n21,
float n22,
float n23,
Shader s,
int highlight,
Matrix4d t)
Draw a supershape around the origin (0/0/0).
|
void |
drawTextBlock(java.lang.String caption,
java.awt.Font font,
float depth,
Shader s,
int highlight,
Matrix4d t) |
protected int |
drawWithDisplayList(int index,
javax.media.opengl.GL gl,
int levels,
float lod) |
float |
estimateScaleAt(Tuple3f point) |
float |
estimateScaleAt(Tuple3f point,
Matrix4d t)
Returns the size of an object of size 1.0 (in object coordinates) on the
screen (in pixels).
|
void |
fillRectangle(int x,
int y,
int w,
int h,
Tuple3f color)
Draw a filled rectangle from (x/y) to (x+w/y+h) with the specified color.
|
java.lang.Object |
getComponent() |
int |
getCurrentHighlight() |
Shader |
getCurrentShader() |
protected java.awt.image.ImageObserver |
getObserverForRenderer()
Returns an observer which receives the information about the
rendered image from a
Renderer. |
Pool |
getPool() |
View3D |
getView3D() |
boolean |
getWindowPos(Tuple3f origin,
Tuple2f out)
Computes the window coordinates in pixels of a location
in the current object coordinates.
|
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
This class implements the ImageObserver interface to be notified
about changes of the background image.
|
void |
init(javax.media.opengl.GLAutoDrawable d)
Initialise opengl state and set default values.
|
protected void |
initRender(int flags)
Performs initialization tasks in preparation for rendering.
|
void |
initView(View view,
EventListener listener)
Initializes this component.
|
protected void |
invokeRender(int flags)
Invoked to perform rendering.
|
static boolean |
isExtensionSupported(javax.media.opengl.GL gl,
java.lang.String extension) |
void |
makeSnapshot(ObjectConsumer<? super java.awt.image.RenderedImage> callback)
Instructs the view component to create a snapshot.
|
protected void |
optionValueChanged(java.lang.String name,
java.lang.Object value) |
protected void |
render(int flags)
Render the scene graph.
|
void |
reshape(javax.media.opengl.GLAutoDrawable d,
int x,
int y,
int w,
int h) |
checkRepaint, checkRepaintWrapException, disposeRenderer, getColor, getColor, getFactory, getFontMetrics, getGlobalLOD, getIntColor, getInterruptedException, getOption, getRenderGraphState, getView, initFactory, installListeners, invokeRenderSync, render, render, renderUninterruptibly, repaint, run, toSelection, uninstallListenersclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFontMetrics, getRenderGraphStatetoSelectionprotected int dlSupershape
public final Pool pool
public static final Type RENDER_MODE
public void display(javax.media.opengl.GLAutoDrawable d)
display in interface javax.media.opengl.GLEventListenerpublic void displayChanged(javax.media.opengl.GLAutoDrawable d,
boolean modeChanged,
boolean deviceChanged)
displayChanged in interface javax.media.opengl.GLEventListenerpublic void dispose()
dispose in interface Disposabledispose in class ViewComponentAdapterpublic void drawBox(float halfWidth,
float halfLength,
float height,
Shader s,
int highlight,
Matrix4d t)
drawBox in interface RenderStateaxis - defines size of boxpublic void drawFrustum(float length,
float baseRadius,
float topRadius,
boolean baseClosed,
boolean topClosed,
float scaleV,
Shader s,
int highlight,
Matrix4d t)
drawFrustum in interface RenderStatepublic void drawFrustumIrregular(float length,
int sectorCount,
float[] baseRadii,
float[] topRadii,
boolean baseClosed,
boolean topclosed,
float scaleV,
Shader s,
int highlight,
Matrix4d t)
drawFrustumIrregular in interface RenderStatepublic void drawLamella(float halfWidth,
float halfLength,
float height,
float a,
float b,
Shader s,
int highlight,
Matrix4d t)
drawLamella in interface RenderStatea - amplitudeb - frequencypublic void drawLine(Tuple3f origin, Tuple3f end, Tuple3f color, int highlight, Matrix4d t)
drawLine in interface RenderStatepublic void drawParallelogram(float length,
Vector3f axis,
float scaleU,
float scaleV,
Shader s,
int highlight,
Matrix4d t)
drawParallelogram in interface RenderStatepublic void drawPlane(Shader s, int highlight, Matrix4d t)
drawPlane in interface RenderStatepublic void drawPoint(Tuple3f origin, int pixelSize, Tuple3f color, int highlight, Matrix4d t)
drawPoint in interface RenderStatepixelSize - size of point on screen in pixelspublic void drawPointCloud(float[] locations,
float pointSize,
Tuple3f color,
int highlight,
Matrix4d t)
RenderStatedrawPointCloud in interface RenderStatelocations - array containing a sequence (x,y,z) of pointspointSize - size of the point on screencolor - color of the pointt - transformation of the point cloudpublic void drawPolygons(Polygonizable pz, java.lang.Object obj, boolean asNode, Shader s, int highlight, Matrix4d t)
drawPolygons in interface RenderStatepublic void drawPrismRectangular(float y,
float xPos,
float xNeg,
float zPos,
float zNeg,
int highlight,
Matrix4d t)
drawPrismRectangular in interface RenderStatepublic void drawRectangle(int x,
int y,
int w,
int h,
Tuple3f color)
drawRectangle in interface RenderStatepublic void drawSphere(float radius,
Shader s,
int highlight,
Matrix4d t)
drawSphere in interface RenderStatepublic void drawString(int x,
int y,
java.lang.String text,
java.awt.Font font,
Tuple3f color)
drawString in interface RenderStatepublic void drawSupershape(float a,
float b,
float m1,
float n11,
float n12,
float n13,
float m2,
float n21,
float n22,
float n23,
Shader s,
int highlight,
Matrix4d t)
drawSupershape in interface RenderStatea, - b length of curvesm, - n shape parametersshader - highlight - t - transformation of the point cloudpublic void drawTextBlock(java.lang.String caption,
java.awt.Font font,
float depth,
Shader s,
int highlight,
Matrix4d t)
drawTextBlock in interface RenderStateprotected int drawWithDisplayList(int index,
javax.media.opengl.GL gl,
int levels,
float lod)
public float estimateScaleAt(Tuple3f point)
estimateScaleAt in interface RenderStatepublic float estimateScaleAt(Tuple3f point, Matrix4d t)
point - t - public void fillRectangle(int x,
int y,
int w,
int h,
Tuple3f color)
fillRectangle in interface RenderStatepublic java.lang.Object getComponent()
getComponent in interface ComponentWrapperpublic int getCurrentHighlight()
getCurrentHighlight in interface RenderStatepublic Shader getCurrentShader()
getCurrentShader in interface RenderStateprotected java.awt.image.ImageObserver getObserverForRenderer()
ViewComponentAdapterRenderer. The returned observer
has to manage the drawing of the (partially) rendered image
on the view component.getObserverForRenderer in class ViewComponentAdapternull if
this is not supported by this componentpublic Pool getPool()
getPool in interface RenderStatepublic View3D getView3D()
public boolean getWindowPos(Tuple3f origin, Tuple2f out)
RenderStategetWindowPos in interface RenderStateorigin - a location in local object coordinatesout - the computed window coordinates are placed in heretrue iff the window coordinates are valid
(i.e., the location is in the clipping region)public boolean imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
imageUpdate in interface java.awt.image.ImageObserverpublic void init(javax.media.opengl.GLAutoDrawable d)
init in interface javax.media.opengl.GLEventListenerprotected void initRender(int flags)
ViewComponentAdapterViewComponentAdapter.run() in this
ViewComponent's own thread.initRender in class ViewComponentAdapterflags - combination of bit maskspublic void initView(View view, EventListener listener)
ViewComponentview
within which this view component is used to display the graph.
It also sets an event listener. this has to be informed of
mouse and keys events within the view component by implementations
of this method.initView in interface ViewComponentinitView in class ViewComponentAdapterview - the containing viewlistener - mouse and key events will be reported to this listenerprotected void invokeRender(int flags)
ViewComponentAdapterViewComponentAdapter.run() in this ViewComponent's own thread.
Its sole task is to invoke ViewComponentAdapter.invokeRenderSync(int) in
the rendering thread (which may be this
ViewComponent's thread, the AWT-thread, or another
thread, depending on the implementation) in a write-protected
context. The invocation has to be
synchronously, i.e., if it is in another thread, the current thread
has to wait until ViewComponentAdapter.invokeRenderSync(int) has completed.invokeRender in class ViewComponentAdapterflags - the flags to pass to ViewComponentAdapter.invokeRenderSync(int)public static boolean isExtensionSupported(javax.media.opengl.GL gl,
java.lang.String extension)
public void makeSnapshot(ObjectConsumer<? super java.awt.image.RenderedImage> callback)
ViewComponentcallback as an
instance of RenderedImage. This may happen asynchronously,
i.e., in an arbitrary thread.makeSnapshot in interface ViewComponentcallback - callback which asynchronously receives the snapshotprotected void optionValueChanged(java.lang.String name,
java.lang.Object value)
optionValueChanged in class ViewComponentAdapterprotected void render(int flags)
throws java.lang.InterruptedException
render in class ViewComponentAdapterflags - combination of bit masksjava.lang.InterruptedException - if the rendering has been interruptedpublic void reshape(javax.media.opengl.GLAutoDrawable d,
int x,
int y,
int w,
int h)
reshape in interface javax.media.opengl.GLEventListener