gama-platform / gama.old

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

[opengl] Drawing some images completely breaks the display #3853

Closed lesquoyb closed 1 year ago

lesquoyb commented 1 year ago

Describe the bug Some images seem to completely break 3d displays when drawn. For example the image "wolf.png" in the model 7 of predator prey tutorial gives that result:

image

changing it by another or not drawing it at all produces the expected result

To Reproduce Steps to reproduce the behavior:

  1. Go to 'model the model 'Tutorials\Predator Prey\models\Model 07.gaml'
  2. make sure that your default display is 3d, if not add the facet to main_display
  3. Run it
  4. See error

Expected behavior The image and the whole display are visible

Desktop (please complete the following information):

Additional context From eclipse I have that stack trace:


com.jogamp.opengl.GLException: Could not find PixelFormat for format and/or type: PixelAttributes[fmt 0x1908, type 0x1405, null]
    at com.jogamp.opengl.util.GLPixelBuffer$GLPixelAttributes.<init>(GLPixelBuffer.java:508)
    at com.jogamp.opengl.util.GLPixelBuffer$GLPixelAttributes.<init>(GLPixelBuffer.java:474)
    at com.jogamp.opengl.util.texture.awt.AWTTextureData.setupLazyCustomConversion(AWTTextureData.java:416)
    at com.jogamp.opengl.util.texture.awt.AWTTextureData.createFromImage(AWTTextureData.java:313)
    at com.jogamp.opengl.util.texture.awt.AWTTextureData.<init>(AWTTextureData.java:127)
    at com.jogamp.opengl.util.texture.awt.AWTTextureIO.newTextureDataImpl(AWTTextureIO.java:127)
    at com.jogamp.opengl.util.texture.awt.AWTTextureIO.newTextureData(AWTTextureIO.java:64)
    at ummisco.gama.opengl.renderer.caches.TextureCache2.buildTexture(TextureCache2.java:219)
    at ummisco.gama.opengl.renderer.caches.TextureCache2.buildTexture(TextureCache2.java:205)
    at ummisco.gama.opengl.renderer.caches.TextureCache2.lambda$4(TextureCache2.java:187)
    at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4853)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4848)
    at ummisco.gama.opengl.renderer.caches.TextureCache2.getTexture(TextureCache2.java:187)
    at ummisco.gama.opengl.renderer.caches.TextureCache2.lambda$3(TextureCache2.java:140)
    at java.base/java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1603)
    at ummisco.gama.opengl.renderer.caches.TextureCache2.processUnloaded(TextureCache2.java:140)
    at ummisco.gama.opengl.OpenGL.processUnloadedCacheObjects(OpenGL.java:1577)
    at ummisco.gama.opengl.OpenGL.beginScene(OpenGL.java:1543)
    at ummisco.gama.opengl.renderer.JOGLRenderer.display(JOGLRenderer.java:207)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:782)
    at ummisco.gama.opengl.view.GamaGLAnimator.lambda$1(GamaGLAnimator.java:166)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4029)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
    at msi.gama.application.Application.start(Application.java:148)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
RoiArthurB commented 1 year ago

image

No problem on MacOS nor Linux :/

lesquoyb commented 1 year ago

I think you are running it in 2d

RoiArthurB commented 1 year ago

Yeah you're right, it fails with a white or black screen on both OS :see_no_evil:

image

lesquoyb commented 1 year ago

The fix works on windows, can you try on linux @RoiArthurB ?