Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kavyro

Pages: [1]
1
Support / Re: JPCT and Jide Docking Framework
« on: September 10, 2021, 10:22:44 am »
Thank you EgonOlsen for you hints. I'll continue to dig into this issue...

2
Support / Re: JPCT and Jide Docking Framework
« on: September 09, 2021, 10:43:41 am »
Ic. Hopefully reseting renderer will fix the issue at the end. Could you share the way you managed to have the box visible in white? That might give a hint for more possible solutions.

Another question... :)
I applied the solution to main project, but it fails with many NPEs inside of JPCT:
Code: [Select]
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.NullPointerException
at com.threed.jpct.AWTJPCTCanvas.paintGL(AWTJPCTCanvas.java:238)
at org.lwjgl.opengl.AWTGLCanvas.paint(AWTGLCanvas.java:339)
at org.lwjgl.opengl.AWTGLCanvas.update(AWTGLCanvas.java:368)
at java.desktop/sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)
at java.desktop/sun.awt.RepaintArea.paint(RepaintArea.java:232)
at java.desktop/sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:358)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5073)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.NullPointerException
at org.lwjgl.BufferChecks.checkDirect(BufferChecks.java:126)
at org.lwjgl.opengl.GL11.glDrawElements(GL11.java:1101)
at com.threed.jpct.CompiledInstance.render(CompiledInstance.java:732)
at com.threed.jpct.AWTGLRenderer.drawVertexArray(AWTGLRenderer.java:1349)
at com.threed.jpct.AWTJPCTCanvas.paintGL(AWTJPCTCanvas.java:198)
... 24 more

Maybe you have a quick hint why is happening so?

3
Support / Re: JPCT and Jide Docking Framework
« on: September 08, 2021, 10:37:00 am »
Sent the project link to you in a private message. The forum reported it as "successful" even I can't see the message in the list of Messages. Hopefully you got it :)

4
Support / Re: JPCT and Jide Docking Framework
« on: September 08, 2021, 10:24:16 am »
Disposing the buffer and recreate again when frame moved seems to do the trick. The cube is shown again :). I'll apply the hack to main project to see how it works. The link to project I'll send you in a private message ;)

5
Support / Re: JPCT and Jide Docking Framework
« on: September 07, 2021, 05:18:12 pm »
Jide has listeners for frame's different states... as a possible solution I was thinking about "reseting" the renderer when frame in moving around. So the next question is how to "quickly" (without reloading textures and other time consuming tasks) reset/recreate/reinit the renderer in the correct way? (If that is possible)

6
Support / Re: JPCT and Jide Docking Framework
« on: September 06, 2021, 08:36:04 pm »
Thank you EgonOlsen for your effort. Your help is really appreciated :)

To exclude differences between batched/not batched elements I created a small new "fresh" project with the code form https://www.jpct.net/wiki/index.php?title=Using_jPCT_in_Swing and Jide. The code was adapted to initialize and run in same way as main project:
   - jpct (rendering) stuff like "game" loop is running in main thread,
   - UI stuff is running in EDT,
   - jpct renderer and UI communicate through listeners when it is needed.

As a result I got same issue - the 3D cube is running OK until the frame is moving around and "disappears" afterwards.
I can send you the project code anytime if you want to have a closer look to it.

7
Support / Re: JPCT and Jide Docking Framework
« on: September 02, 2021, 05:11:16 pm »
Nope, unfortunately it didn't fix the issue :(. Elements still disappear.

8
Support / Re: JPCT and Jide Docking Framework
« on: September 02, 2021, 02:43:46 pm »
Yes, it is done in component listener

Code: [Select]
     addComponentListener(new ComponentAdapter() {

      @Override
      public void componentResized(ComponentEvent e) {
        resizeRenderer(getSize());
      }

    });

I'd like to add some more info which hopefully can help to identify the reason of issue. I was thinking what's special about those elements remaining visible. It turns out we have elements added in batches and have ones added directly. Apparently those not using batches remain visible.

Here is a part of code where the world is created:

Code: [Select]
public void setupWorld() {
...
HashSet<Element> nonBatched = new HashSet<>();
// add non batched elements here
...

worldObject = Object3D.createDummyObj();

for (Group group : getElementGroups()) {
     
List<Object3D> objects = new ArrayList<Object3D>();

for (Element element : group.getElements()) {
 
  try {
Object3D object = new Object3D(0);
element.setObject3D(object);
if (element.isBatchEnabled() && !nonBatched.contains(element)) {
  objects.add(object);
} else {
  object.setAdditionalColor(RGBColor.white);
  object.compile(true, true, true, true, 8000);
  world.addObject(object);
  group.addObject3D(object);
}
  } catch (Exception e) {
_log.error("Unable to create Object3D for element : " + element, e);
  }
}
Object3D object = null;
if (objects.size() > 0) {
  object = Object3D.mergeAll(objects.toArray(new Object3D[objects.size()]));
  object.setTexture(TextureHandler.ELEMENTS_TEXTURENAME);
  object.setName(group.getName());
  object.setVisibility(group.isVisible());
  object.setAdditionalColor(Color.white);
  object.compileAndStrip();
  world.addObject(object);
  worldObject.addChild(object);
  group.addObject3D(object);
}     
    }
...
}

9
Support / Re: JPCT and Jide Docking Framework
« on: September 02, 2021, 11:40:44 am »
Nope, JPCT logs nothing when resize. At all.

10
Support / Re: JPCT and Jide Docking Framework
« on: September 01, 2021, 11:08:43 am »
Yep, I perfectly know that. But the issue in my case is so strange...
Now I call buffer resize() when output windows size changes, but it makes no difference - the issue is still there

11
Support / JPCT and Jide Docking Framework
« on: September 01, 2021, 10:42:00 am »
In our project we use JPCT together with Jide Docking Framework (http://www.jidesoft.com/products/dock.htm). Jide arranges components in "frames". The JPCT canvas (buffer.enableGLCanvasRenderer()) is also running as a separate "frame", so user can move/minimize/maximize the frame freely. Jide frames works perfectly with swing components, but has issues when it comes to JPCT. When application starts everything works OK: the JPCT canvas displays the world with all objects (see screenshot "before.png" in attachments). However when JPCT frame is moved/minimized/maximized/etc most of the objects "disappears" (screenshot "after.png"). It is extremely hard to identify what exactly produces such issues. Neither Jide or JPCT logs any errors. Since not all objects "disappear" but most of them it looks like JPCT issue. So the question is - is it a JPCT issue? Can you point me to correct direction if the issue is related to JPCT?

Some code related to JPCT init:
Code: [Select]
...
protected void setupFrameBuffer(Dimension size) {
    Dimension framebufferSize = size == null ? Toolkit.getDefaultToolkit().getScreenSize() : size;

    _buffer = new FrameBuffer(framebufferSize.width, framebufferSize.height, FrameBuffer.SAMPLINGMODE_NORMAL);

    _frameBufferBGColor = DEFAULT_FRAMEBUFFER_BG_COLOR;

    _buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
    _buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
    _canvas = _buffer.enableGLCanvasRenderer();
   
    _textureHandler.setFrameBuffer(_buffer);
    _textureHandler.setCanvas(_canvas);
   
    getNotifier().rendererInitialized(_canvas);
  }

  ...
  public void updateFrameBuffer() {
    _performanceStatistics.incrementFPS();
    _performanceStatistics.startMethod();

    _buffer.clear(_frameBufferBGColor);

    world.renderScene(_buffer);
    world.draw(_buffer);
    _textureHandler.blit();

    _buffer.update();

    _videoHandler.encodeFrame(_currentDate);

    _buffer.displayGLOnly();

    _canvas.repaint();
   
    _performanceStatistics.endDrawMethod();
  }

Pages: [1]