public class ViewCanvas extends GlCanvas
The relationship between views and view canvases is one-to-many. A view canvas is managed by only one view, but that view may draw its world on on one or more view canvases.
Constructor and Description |
---|
ViewCanvas()
Constructs a canvas with no view.
|
ViewCanvas(View view)
Constructs a canvas for the specified view.
|
Modifier and Type | Method and Description |
---|---|
Matrix44 |
getCubeToPixel()
Gets the cube-to-pixel transform for this canvas.
|
double |
getPixelZ(int xp,
int yp)
Gets the pixel z coordinate at the specified pixel x and y coordinates.
|
View |
getView()
Gets the view that draws on this canvas.
|
Matrix44 |
getViewToCube()
Gets the view-to-cube transform for this canvas.
|
void |
glInit()
Initializes OpenGL state when this canvas is first painted.
|
void |
glPaint()
Paints this canvas via OpenGL.
|
void |
glResize(int width,
int height,
int widthBefore,
int heightBefore)
Modifies OpenGL state when this canvas has been resized.
|
void |
setCubeToPixel(Matrix44 cubeToPixel)
Sets the cube-to-pixel transform for this canvas.
|
void |
setView(View view)
Sets the view that draws on this canvas.
|
void |
setViewToCube(Matrix44 viewToCube)
Sets the view-to-cube transform for this canvas.
|
display, displayChanged, dispose, init, paintToFile, reshape, runWithContext, setAutoRepaint
addGLEventListener, addGLEventListener, addNotify, createContext, destroy, display, getAnimator, getAutoSwapBufferMode, getChosenGLCapabilities, getContext, getContextCreationFlags, getDefaultCloseOperation, getDelegatedDrawable, getFactory, getGL, getGLProfile, getGraphicsConfiguration, getHandle, getNativeSurface, getRequestedGLCapabilities, getShallUseOffscreenLayer, getThreadName, getUpstreamWidget, invoke, isOffscreenLayerSurfaceEnabled, isRealized, main, paint, removeGLEventListener, removeGLEventListener, removeNotify, reshape, setAnimator, setAutoSwapBufferMode, setContext, setContextCreationFlags, setDefaultCloseOperation, setGL, setRealized, setShallUseOffscreenLayer, swapBuffers, toString, update
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener
public ViewCanvas()
public ViewCanvas(View view)
view
- the view.public void setView(View view)
view
- the view; null, if none.public View getView()
public void setViewToCube(Matrix44 viewToCube)
viewToCube
- the view-to-cube transform; copied, not referenced.public Matrix44 getViewToCube()
public void setCubeToPixel(Matrix44 cubeToPixel)
cubeToPixel
- the cube-to-pixel transform; copied, not referenced.public Matrix44 getCubeToPixel()
public double getPixelZ(int xp, int yp)
The pixel z coordinate is a floating point number between 0.0 and 1.0. The value zp = 0.0 corresponds to the near clipping plane, and the value zp = 1.0 corresponds to the far clipping plane.
xp
- the pixel x coordinate.yp
- the pixel y coordinate.public void glInit()
GlCanvas
GlCanvas.glResize(int,int,int,int)
and GlCanvas.glPaint()
when (1)
this canvas must be painted and (2) it has never been painted before.
In classes that extend this class, implementations of this method use the OpenGL context that has been locked for the current thread. This implementation does nothing.
public void glPaint()
GlCanvas
In classes that extend this class, implementations of this method use the OpenGL context that has been locked for the current thread. This implementation does nothing.
public void glResize(int width, int height, int widthBefore, int heightBefore)
GlCanvas
GlCanvas.glPaint()
when
(1) this canvas must be painted and (2) its width or height have
changed since it was last painted or it has never been painted.
In classes that extend this class, implementations of this method use the OpenGL context that has been locked for the current thread. This implementation does nothing.