diff options
author | Sven Gothel <[email protected]> | 2009-03-14 05:20:29 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-14 05:20:29 +0000 |
commit | 9517d52c18bfa93d78e03f4c212757eda421afb6 (patch) | |
tree | 8c1bc95802461520f3477c3c224d285debff4e2c /src/classes/javax/media/opengl/util/PMVMatrix.java | |
parent | 78ff34edd75db5cd7f3055466d992ca7be3a70a6 (diff) |
NEWT window closing:
- New WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY and
WindowListener.windowDestroyNotify() method.
- Removed windowClosed() method for JNI hook
- Added windowDestroyNotify() windowDestroyed(),
where windowDestroyNotify() shall be called by the native implementation
_before_ the window gets shutdown.
The Window.java then sends a WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY event,
and either Window.java or it's owner GLWindow.java issues the destroy()
procedure.
- Added GLEventListener.dispose(GLAutoDrawable),
to allow user application to release GL ressources.
Issued by GLWindow (-> see windowDestroyNotify())
- X11 impl intercepts WM_DELETE_WINDOW, using Atom,
MacosX impl already uses the _before_ method (VERIFY),
and Windows impl uses the WM_CLOSE event (VERIFY).
JOGL2 dispose/destroy ..
- Added GLEventListener.dispose() to GLCanvas and GLJpanel
- GL* toString() rearrangement, assumes it is issued by GLContext(),
which indeed is the core information node.
- Added proper destroy() methods and calls,
to achieve a proper resource release at destruction.
Instrumentizing almost all classes with a destroy() method,
so no release function lookup is necessary.
- misc changes ..
JOGL2 Demos
- Fixed in regards to the above changes
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1867 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax/media/opengl/util/PMVMatrix.java')
-rwxr-xr-x | src/classes/javax/media/opengl/util/PMVMatrix.java | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/src/classes/javax/media/opengl/util/PMVMatrix.java b/src/classes/javax/media/opengl/util/PMVMatrix.java index 5a69b920c..649e9942a 100755 --- a/src/classes/javax/media/opengl/util/PMVMatrix.java +++ b/src/classes/javax/media/opengl/util/PMVMatrix.java @@ -43,23 +43,23 @@ public class PMVMatrix implements GLMatrixIf { matrixMvit3 = BufferUtil.newFloatBuffer(3*3); - FloatBuffer buf = BufferUtil.newFloatBuffer(6*16); + localBuf = BufferUtil.newFloatBuffer(6*16); - matrixMult=slice(buf, 0*16, 16); + matrixMult=slice(localBuf, 0*16, 16); - matrixTrans=slice(buf, 1*16, 16); + matrixTrans=slice(localBuf, 1*16, 16); projectFloat.gluMakeIdentityf(matrixTrans); - matrixRot=slice(buf, 2*16, 16); + matrixRot=slice(localBuf, 2*16, 16); projectFloat.gluMakeIdentityf(matrixRot); - matrixScale=slice(buf, 3*16, 16); + matrixScale=slice(localBuf, 3*16, 16); projectFloat.gluMakeIdentityf(matrixScale); - matrixOrtho=slice(buf, 4*16, 16); + matrixOrtho=slice(localBuf, 4*16, 16); projectFloat.gluMakeIdentityf(matrixOrtho); - matrixFrustum=slice(buf, 5*16, 16); + matrixFrustum=slice(localBuf, 5*16, 16); projectFloat.gluMakeZero(matrixFrustum); vec3f=new float[3]; @@ -77,6 +77,43 @@ public class PMVMatrix implements GLMatrixIf { setDirty(); } + public void destroy() { + if(null!=projectFloat) { + projectFloat.destroy(); projectFloat=null; + } + + if(null!=matrixIdent) { + matrixIdent.clear(); matrixIdent=null; + } + if(null!=matrixTPMvMvitPmv) { + matrixTPMvMvitPmv.clear(); matrixTPMvMvitPmv=null; + } + if(null!=matrixMvit3) { + matrixMvit3.clear(); matrixMvit3=null; + } + if(null!=localBuf) { + localBuf.clear(); localBuf=null; + } + + if(null!=matrixPStack) { + matrixPStack.clear(); matrixPStack=null; + } + vec3f=null; + if(null!=matrixMvStack) { + matrixMvStack.clear(); matrixMvStack=null; + } + if(null!=matrixPStack) { + matrixPStack.clear(); matrixPStack=null; + } + if(null!=matrixTStack) { + matrixTStack.clear(); matrixTStack=null; + } + + matrixTPMvMvitPmv=null; matrixPMvMvit=null; matrixPMvMvitPmv=null; matrixPMvMvi=null; matrixPMv=null; + matrixP=null; matrixT=null; matrixMv=null; matrixMvi=null; matrixMvit=null; matrixPmv=null; + matrixMult=null; matrixTrans=null; matrixRot=null; matrixScale=null; matrixOrtho=null; matrixFrustum=null; + } + private static FloatBuffer slice(FloatBuffer buf, int pos, int len) { buf.position(pos); buf.limit(pos + len); @@ -606,7 +643,7 @@ public class PMVMatrix implements GLMatrixIf { protected FloatBuffer matrixIdent; protected FloatBuffer matrixTPMvMvitPmv, matrixPMvMvit, matrixPMvMvitPmv, matrixPMvMvi, matrixPMv, matrixP, matrixT, matrixMv, matrixMvi, matrixMvit, matrixPmv; protected FloatBuffer matrixMvit3; - protected FloatBuffer matrixMult, matrixTrans, matrixRot, matrixScale, matrixOrtho, matrixFrustum; + protected FloatBuffer localBuf, matrixMult, matrixTrans, matrixRot, matrixScale, matrixOrtho, matrixFrustum; protected float[] vec3f; protected List/*FloatBuffer*/ matrixTStack, matrixPStack, matrixMvStack; protected int matrixMode = GL_MODELVIEW; |