ch.dieseite.glemulator

## Class PEmulator

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JPanel
        - - ch.dieseite.glemulator.PEmulator

- All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
  Direct Known Subclasses:
    GLAdapter

      abstract class PEmulator
      extends javax.swing.JPanel

  This class emulates some 3D Processing methods using direct access to the JOGL library.(see http://www.jogamp.org/ This Emulator is usefull if OPENGL mode on Processing is not working

  This source underlies the GNU General Public License; You can redistribute it or modify by nameing the originally author

  Version:
    3.1
  Author:
    Markus Zimmermann http://www.die-seite.ch

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class javax.swing.JPanel

      `javax.swing.JPanel.AccessibleJPanel`

    - ### Nested classes/interfaces inherited from class javax.swing.JComponent

      `javax.swing.JComponent.AccessibleJComponent`

    - ### Nested classes/interfaces inherited from class java.awt.Container

      `java.awt.Container.AccessibleAWTContainer`

    - ### Nested classes/interfaces inherited from class java.awt.Component

      `java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private GLCanvas` | `canvas`
    `private GL2` | `currentGL2`
    `private PImage` | `currentImage`
    `private int` | `currentShapeMode`
    `private Texture` | `currentTexture`
    `private int` | `h`
    `private java.util.HashMap<PImage,Texture>` | `textureCache`
    `protected static int` | `TRIANGLE`
    `private int` | `w`

    - ### Fields inherited from class javax.swing.JComponent

      `listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

    - ### Fields inherited from class java.awt.Component

      `accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

    - ### Fields inherited from interface java.awt.image.ImageObserver

      `ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `PEmulator(int width, int height)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `_background(float c)` refer to processing API
    `protected void` | `_beginShape(int mode)` see Processing API
    `protected int` | `_color(int r, int g, int b, int a)` returns a processing pixel (see Processing API)
    `protected void` | `_endShape()` see Processing API
    `protected void` | `_fill(float c)` see Processing API
    `protected void` | `_fill(float r, float g, float b, float t)` see Processing API
    `protected void` | `_lights()` see Processing API
    `protected void` | `_line(float xa, float ya, float za, float xb, float yb, float zb)` see Processing API
    `protected void` | `_rotateX(float angle)` see Processing API
    `protected void` | `_rotateY(float angle)` see Processing API
    `protected void` | `_rotateZ(float angle)` see Processing API
    `protected void` | `_scale(float v)` see Processing API
    `protected void` | `_stroke(float r, float g, float b)` see Processing API
    `protected void` | `_strokeWeight(float w)` see Processing API
    `protected void` | `_texture(PImage img)` refer to processing API
    `protected void` | `_translate(float x, float y, float z)` see Processing API
    `protected void` | `_vertex(float x, float y, float z)` see Processing API
    `protected void` | `_vertex(float x, float y, float z, float tx, float ty)` see Processing API
    `private Texture` | `createTexture(int width, int height, int[] pixels)` a helper to create a GL Texture based on processing spec's
    `void` | `display(GLAutoDrawable drawable)`
    `void` | `dispose(GLAutoDrawable arg0)`
    `(package private) abstract void` | `execQueue()` draws the polygons and lines.
    `void` | `GLConfig()` Does a printout of the current GL version and driver
    `void` | `init(GLAutoDrawable drawable)`
    `void` | `repaint()`
    `void` | `reshape(GLAutoDrawable drawable, int x, int y, int width, int height)`

    - ### Methods inherited from class javax.swing.JPanel

      `getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

    - ### Methods inherited from class javax.swing.JComponent

      `addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

    - ### Methods inherited from class java.awt.Container

      `add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree`

    - ### Methods inherited from class java.awt.Component

      `action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### TRIANGLE

          protected static final int TRIANGLE

    - #### w

          private int w

    - #### h

          private int h

    - #### currentShapeMode

          private int currentShapeMode

    - #### currentGL2

          private GL2 currentGL2

    - #### currentTexture

          private Texture currentTexture

    - #### currentImage

          private PImage currentImage

    - #### textureCache

          private java.util.HashMap<PImage,Texture> textureCache

    - #### canvas

          private GLCanvas canvas

  - ### Constructor Detail

    - #### PEmulator

          protected PEmulator(int width,
                              int height)

  - ### Method Detail

    - #### GLConfig

          public void GLConfig()

      Does a printout of the current GL version and driver

    - #### execQueue

          abstract void execQueue()

      draws the polygons and lines. Must be overridden by GLAdapter

    - #### createTexture

          private Texture createTexture(int width,
                                        int height,
                                        int[] pixels)

      a helper to create a GL Texture based on processing spec's

    - #### display

          public void display(GLAutoDrawable drawable)

    - #### init

          public void init(GLAutoDrawable drawable)

    - #### reshape

          public void reshape(GLAutoDrawable drawable,
                              int x,
                              int y,
                              int width,
                              int height)

    - #### dispose

          public void dispose(GLAutoDrawable arg0)

    - #### repaint

          public void repaint()

      Overrides:
        `repaint` in class `java.awt.Component`

    - #### _lights

          protected void _lights()

      see Processing API

    - #### _strokeWeight

          protected void _strokeWeight(float w)

      see Processing API

    - #### _stroke

          protected void _stroke(float r,
                                 float g,
                                 float b)

      see Processing API

    - #### _line

          protected void _line(float xa,
                               float ya,
                               float za,
                               float xb,
                               float yb,
                               float zb)

      see Processing API

    - #### _translate

          protected void _translate(float x,
                                    float y,
                                    float z)

      see Processing API

    - #### _rotateY

          protected void _rotateY(float angle)

      see Processing API

    - #### _rotateX

          protected void _rotateX(float angle)

      see Processing API

    - #### _rotateZ

          protected void _rotateZ(float angle)

      see Processing API

    - #### _scale

          protected void _scale(float v)

      see Processing API

    - #### _beginShape

          protected void _beginShape(int mode)

      see Processing API

    - #### _endShape

          protected void _endShape()

      see Processing API

    - #### _fill

          protected void _fill(float r,
                               float g,
                               float b,
                               float t)

      see Processing API

    - #### _fill

          protected void _fill(float c)

      see Processing API

    - #### _vertex

          protected void _vertex(float x,
                                 float y,
                                 float z)

      see Processing API

    - #### _vertex

          protected void _vertex(float x,
                                 float y,
                                 float z,
                                 float tx,
                                 float ty)

      see Processing API

    - #### _color

          protected int _color(int r,
                               int g,
                               int b,
                               int a)

      returns a processing pixel (see Processing API)

    - #### _texture

          protected void _texture(PImage img)

      refer to processing API
      Parameters:
        `img` -

    - #### _background

          protected void _background(float c)

      refer to processing API
      Parameters:
        `img` -