gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
302 stars 99 forks source link

GAMA crash when re-launch a current simulation with texture (Built-in shapes.gaml) #2941

Closed hqnghi88 closed 4 years ago

hqnghi88 commented 4 years ago

Describe the bug Testing the simple model of Benoit in issue #2914 , i get a strange behavior

global {
    image_file Gama0_image_file <- image_file("../images/Gama.jpg");

    init {
        create t {
            shape <- square(50);
        }
    }
}

species t {
    aspect base{
        draw shape texture:Gama0_image_file border: #black ;
    }
}

experiment NewModel type: gui {

    output {

        display o type: opengl {
            graphics world{ 
              draw geometry(world.shape) texture:Gama0_image_file ;
              draw world.shape border: #black empty:true;
            }
        }   

        display d type: opengl {
            image Gama0_image_file;
            species t aspect: base;
        }
    }
}

To Reproduce Steps to reproduce the behavior:

  1. Go to "Visualization and User Interaction\Visualization\3D Visualization\models\Built-in Shapes.gaml"
  2. Click on '3D Shapes' button, wait still it's ready
  3. Switch to modeling perspective
  4. Click again on '3D Shapes' experiment button

Expected behavior Works fine

Screenshots Here is screenshot before crash image

And the exception in eclipse

com.jogamp.opengl.GLException: Unable to create temp OpenGL context for device context 0xfffffffff20114de at jogamp.opengl.windows.wgl.WindowsWGLContext.createImpl(WindowsWGLContext.java:352) at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:765) at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:648) at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:586) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1279) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) at com.jogamp.opengl.swt.GLCanvas$3.run(GLCanvas.java:171) at com.jogamp.opengl.swt.GLCanvas.runInGLThread(GLCanvas.java:960) at com.jogamp.opengl.swt.GLCanvas.displayIfNoAnimatorNoCheck(GLCanvas.java:647) at com.jogamp.opengl.swt.GLCanvas.access$1000(GLCanvas.java:96) at com.jogamp.opengl.swt.GLCanvas$7.handleEvent(GLCanvas.java:390) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4131) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1055) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1064) at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:1654) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4825) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:348) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4778) at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3545) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:566) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at msi.gama.application.Application.start(Application.java:126) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:661) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597) at org.eclipse.equinox.launcher.Main.run(Main.java:1476) at org.eclipse.equinox.launcher.Main.main(Main.java:1449) com.jogamp.opengl.GLException: Unable to create temp OpenGL context for device context 0xfffffffffd0118ae at jogamp.opengl.windows.wgl.WindowsWGLContext.createImpl(WindowsWGLContext.java:352) at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:765) at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:648) at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:586) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1279) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) at com.jogamp.opengl.swt.GLCanvas$3.run(GLCanvas.java:171) at com.jogamp.opengl.swt.GLCanvas.runInGLThread(GLCanvas.java:960) at com.jogamp.opengl.swt.GLCanvas.display(GLCanvas.java:659) at ummisco.gama.opengl.view.SWTGLAnimator.displayGL(SWTGLAnimator.java:199) at ummisco.gama.opengl.view.SWTGLAnimator.run(SWTGLAnimator.java:180) at java.lang.Thread.run(Thread.java:748)

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

AlexisDrogoul commented 4 years ago

Not reproducible on macOS.

hqnghi88 commented 4 years ago

Dear Alexis, It seems to be the problem with waiting time of opengl thread as when i switch on "Ask to close the previous experiment..." it works fine.

hqnghi88 commented 4 years ago

Tested on 1 other win, not reproducible then.