]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - vtk.rendering/src/vtk/rendering/swt/vtkInternalSwtComponent.java
Various fixes to vtk swt components
[simantics/3d.git] / vtk.rendering / src / vtk / rendering / swt / vtkInternalSwtComponent.java
index 2d73b3d502288ee5d7bd2a33ef9463573e482516..ce10c783dde65667ed43c3ad5f03cad2acbf4b1e 100644 (file)
@@ -28,10 +28,29 @@ public class vtkInternalSwtComponent extends GLCanvas implements Listener {
     caps = new GLCapabilities(GLProfile.get(GLProfile.GL2GL3));
     caps.setDoubleBuffered(true);
     caps.setHardwareAccelerated(true);
-    caps.setSampleBuffers(false);
-    caps.setNumSamples(4);
+    caps.setSampleBuffers(true);
     
+    caps.setRedBits(8);
+    caps.setGreenBits(8);
+    caps.setBlueBits(8);
     caps.setAlphaBits(8);
+    caps.setDepthBits(24);
+    caps.setStencilBits(8);
+    
+//    caps.setAccumRedBits(8);
+//    caps.setAccumGreenBits(8);
+//    caps.setAccumBlueBits(8);
+//    caps.setAccumAlphaBits(8);
+//    
+//    caps.setBitmap(true);
+//    caps.setOnscreen(true);
+    
+    
+    //caps.setPBuffer(true);
+    //caps.setFBO(true);
+    caps.setNumSamples(4);
+    
+    
 
     return caps;
   }
@@ -97,10 +116,18 @@ public class vtkInternalSwtComponent extends GLCanvas implements Listener {
     this.removeListener(SWT.Close, this);
     this.removeListener(SWT.Dispose, this);
     this.removeListener(SWT.Resize, this);
+    
+    if (parent != null) {
+       parent.getRenderer().DrawOff();
+       parent.Delete();
+       vtkObject.JAVA_OBJECT_MANAGER.gc(false);
+       parent = null;
+    }
 
-    if (getContext().isCurrent()) {
+    if (getContext() != null && getContext().isCurrent()) {
       getContext().release();
     }
+    
     super.dispose();
   }
 
@@ -117,7 +144,6 @@ public class vtkInternalSwtComponent extends GLCanvas implements Listener {
       vtkObject.JAVA_OBJECT_MANAGER.gc(false);
       break;
     case SWT.Close:
-      // System.out.println("closing");
       break;
     case SWT.Resize:
       parent.setSize(getClientArea().width, getClientArea().height);