|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Canvas | +--gl4java.awt.GLCanvas | +--gl4java.awt.GLAnimCanvas | +--md3.md3view.MD3GLCanvas
OpenGL Canvas with functionality to render MD3 models and MD3GLTextures.
It will also react to mouseDragged events. If you drag with the first mouse button and don't hold the shift key, you will rotate the model. Dragging the first mouse button while holding down shift will pan the model in the x-y plane. Dragging with the third mouse button scales the model.
Field Summary | |
static int |
FLAT_SHADED
Flat shaded render mode. |
static int |
FLAT_TEXTURED
Flat textured render mode. |
static int |
MODEL_MODE
Model rendering mode. |
static int |
SHADED_TEXTURED
Shaded textured render mode. |
static int |
TEXTURE_MODE
Texture rendering mode. |
static int |
WIRE_FRAME
Wire frame render mode. |
Fields inherited from class gl4java.awt.GLAnimCanvas |
dFpsMilli,
FramesPerSec,
killme,
mSecPerFrame,
shallWeRender,
threadSuspended,
useFpsSleep,
useRepaint |
Fields inherited from class gl4java.awt.GLCanvas |
_f_dur,
cvsInitialized,
doubleBuffer,
gl,
glj,
glu,
mustResize,
needCvsDispose,
size,
stereoView,
topLevelWindow |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
MD3GLCanvas(int width,
int height)
Constructor that creates a new MD3 OpenGL Canvas with the specified width and height. |
Method Summary | |
void |
activateRenderMode()
Activate the current rendering mode. |
void |
display()
Override needed when using GLCanvas: render 1 frame, called by paint. |
void |
dumpCanvasToTGA(java.lang.String filename)
Dump the image on the canvas to a Targa file. |
MD3Animation |
getAnimation()
Return the currently active animation of the canvas. |
protected gl4java.GLFunc |
getGL()
Return a GLFunc object that you can use to draw something on this canvas. |
protected gl4java.GLUFunc |
getGLU()
Return the canvas's GLUFunc object. |
int |
getMode()
Return the current mode of operation of this canvas (TEXTURE_MODE or MODEL_MODE). |
MD3Model |
getModel()
Return the top level model rendered on this canvas. |
int |
getRenderMode()
Returns the currently used rendering mode. |
MD3GLTexture |
getTexture()
Return the current texture (rendered in TEXTURE_MODE) of this canvas. |
void |
init()
Override needed when using GLCanvas: create java-stuff and do GL-inits. |
void |
nextFrame()
Switch to the next frame in the current animation of the model. |
void |
previousFrame()
Switch to the previous frame in the current animation. |
void |
ReInit()
Override needed when using GLAnimCanvas: re-initialisation after stop for setSuspended(false). |
void |
resetManipulations()
Reset all user manipulations (scaling + panning + rotating) of this model canvas. |
void |
reshape(int width,
int height)
Override needed when using GLCanvas: resize canvas. |
void |
rewindAnimation()
Rewind the animation of the model back to the first frame. |
void |
setAnimate(boolean b)
Start or stop the currently selected animation of the displayed model. |
void |
setAnimation(MD3Animation anim)
Set the animation of the model that will be displayed on the canvas. |
void |
setInterpolate(boolean b)
Enable or disable interpolation between key animation frames. |
void |
setMode(int mode)
Set the operation mode of the canvas. |
void |
setModel(MD3Model model)
Set the top level model that is rendered on the canvas. |
void |
setRenderMode(int rendermode)
Switch the display to the specified render mode. |
void |
setTexture(MD3GLTexture texture)
Set the texture that will be rendered on the canvas. |
Methods inherited from class gl4java.awt.GLAnimCanvas |
getFps,
getFpsDuration,
getFpsFrames,
getMaxFps,
getUseFpsSleep,
getUseRepaint,
isAlive,
isSuspended,
resetFpsCounter,
run,
setAnimateFps,
setAnimateFps,
setSuspended,
setSuspended,
setUseFpsSleep,
setUseRepaint,
setVerboseFps,
start,
stop,
stopFpsCounter |
Methods inherited from class gl4java.awt.GLCanvas |
componentHidden,
componentMoved,
componentResized,
componentShown,
cvsDispose,
cvsGetHeight,
cvsGetWidth,
cvsIsInit,
doCleanup,
getGLContext,
getMinimumSize,
getPreferredSize,
getTopLevelWindow,
paint,
preInit,
sDisplay,
update,
windowActivated,
windowClosed,
windowClosing,
windowDeactivated,
windowDeiconified,
windowIconified,
windowOpened |
Methods inherited from class java.awt.Canvas |
addNotify |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
deliverEvent,
disable,
disableEvents,
dispatchEvent,
doLayout,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getAlignmentX,
getAlignmentY,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentAt,
getComponentAt,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocation,
getLocationOnScreen,
getMaximumSize,
getName,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
invalidate,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
isLightweight,
isOpaque,
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,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
resize,
resize,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setCursor,
setDropTarget,
setEnabled,
setFont,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus,
validate |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int MODEL_MODE
Model rendering mode. The current MD3 model will be rendered.
public static final int TEXTURE_MODE
Texture rendering mode. The current texture will be rendered.
public static final int WIRE_FRAME
Wire frame render mode.
public static final int FLAT_SHADED
Flat shaded render mode.
public static final int FLAT_TEXTURED
Flat textured render mode.
public static final int SHADED_TEXTURED
Shaded textured render mode.
Constructor Detail |
public MD3GLCanvas(int width, int height)
Constructor that creates a new MD3 OpenGL Canvas with the specified width and height. It also sets up the required listeners for the mouseDragged events.
By default, animation and quick manipulations are off, interpolation is on, bone frames or not drawn and the mode is MODEL_MODE.
width
- Width of the canvas.height
- Height of the canvas.Method Detail |
protected gl4java.GLFunc getGL()
Return a GLFunc object that you can use to draw something on this canvas.
protected gl4java.GLUFunc getGLU()
Return the canvas's GLUFunc object.
public void display()
Override needed when using GLCanvas: render 1 frame, called by paint.
public void reshape(int width, int height)
Override needed when using GLCanvas: resize canvas.
public void init()
Override needed when using GLCanvas: create java-stuff and do GL-inits.
public void ReInit()
Override needed when using GLAnimCanvas: re-initialisation after stop for setSuspended(false).
public void resetManipulations()
Reset all user manipulations (scaling + panning + rotating) of this model canvas.
public void setModel(MD3Model model)
Set the top level model that is rendered on the canvas. This will reset any manipulation that have been done on the canvas (rotate + pan + scale). The canvas will switch to MODEL_MODE.
Uploading of texture data to OpenGL is the responsability of the client!
model
- The MD3Model to render.public MD3Model getModel()
Return the top level model rendered on this canvas.
public void setTexture(MD3GLTexture texture)
Set the texture that will be rendered on the canvas. This will reset any manipulations and switch to TEXTURE_MODE.
Uploading of texture data to OpenGL is the responsability of the client!
public MD3GLTexture getTexture()
Return the current texture (rendered in TEXTURE_MODE) of this canvas.
public void setMode(int mode)
Set the operation mode of the canvas. In MODEL_MODE, an MD3Model will be rendered. When in TEXTURE_MODE, a MD3GLTexture object will be shown.
public int getMode()
Return the current mode of operation of this canvas (TEXTURE_MODE or MODEL_MODE).
public void setAnimate(boolean b)
Start or stop the currently selected animation of the displayed model.
b
- true will start the animation, false will stop it.public void setAnimation(MD3Animation anim)
Set the animation of the model that will be displayed on the canvas.
anim
- The animation to play.public MD3Animation getAnimation()
Return the currently active animation of the canvas.
public void nextFrame()
Switch to the next frame in the current animation of the model.
public void previousFrame()
Switch to the previous frame in the current animation.
public void rewindAnimation()
Rewind the animation of the model back to the first frame.
public void setInterpolate(boolean b)
Enable or disable interpolation between key animation frames.
public void setRenderMode(int rendermode)
Switch the display to the specified render mode. The supported rendering modes are: WIRE_FRAME, FLAT_SHADED, FLAT_TEXTURED and SHADED_TEXTURED.
Note that the new rendermode will only become active after a call to the activateRenderMode() method.
This method will have no effect when the canvas is in TEXTURE_MODE.
rendermode
- The render mode to swith to.public void activateRenderMode()
Activate the current rendering mode.
public int getRenderMode()
Returns the currently used rendering mode.
public void dumpCanvasToTGA(java.lang.String filename) throws java.io.IOException
Dump the image on the canvas to a Targa file.
filename
- Name of the output file.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |