Main Menu
Menu

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.

Show posts Menu

Messages - EgonOlsen

#1
Support / Re: Object3D.mergeAll(List)
October 10, 2025, 10:55:00 AM
This should work:

Object3D.mergeAll(new SimpleGlbLoader().loadGlbNoSkin(modelFile).toArray(new Object3D[1]))
#2
Support / Re: Problem with AWTGLCanvas
October 06, 2025, 10:31:30 AM
Opps, I missed that. I've updated the download, please try again.
#3
Support / Re: Problem with AWTGLCanvas
September 29, 2025, 10:53:14 AM
I've compiled a new version that includes that change (actually, the code above isn't 100% correct, because it does some changes to the existing code that make no sense, but I've omitted those).

Can you try this one and see if it also fixes your issue: https://www.jpct.de/download/net/jpctapi_133.zip
#4
Support / Re: Problem with AWTGLCanvas
September 27, 2025, 02:31:26 PM
Quote from: AGP on September 27, 2025, 09:01:49 AMI tried quoting this line, but it didn't show up for some reason:
Have you actually tried this approach: https://www.jpct.net/wiki/index226d.html?title=Using_jPCT_in_Swing

This example seems to be using software rendering.

I don't think so. At the least the text says it's for the AWTGL-Renderer. As mentioned, I've never tried anything like that myself.
#5
Support / Re: Problem with AWTGLCanvas
September 26, 2025, 08:17:39 AM
Quote from: AGP on September 26, 2025, 01:47:01 AMThis seems to be software. Am I missing something?
I'm not sure what you mean!?
#6
Support / Re: Problem with AWTGLCanvas
September 25, 2025, 05:30:37 PM
I'm not of much help here, I'm afraid. I've actually no clue about UI stuff in Java. All I'm usually doing is to open a JFrame/Frame and then draw stuff all by myself.

I dimly remember that others tried to mix an actual UI with the AWTGLCanvas and IIRC, it didn't work our too well (but was possible to a degree). But I couldn't find this thread.

Have you actually tried this approach: https://www.jpct.net/wiki/index226d.html?title=Using_jPCT_in_Swing
#7
Bugs / Re: Can't Switch Between 2D and 3D
September 25, 2025, 05:27:08 PM
I'm not sure what you are trying to achieve. Do you want to switch between a 2D UI and a 3D render or simply between to renders, one software and one hardware?

I tried the latter with the fps example included in the distribution. For me, it worked fine unless I tried to use Java 2D in fullscreen. With that enabled, I ended up with the desktop being rendered 640*480.

I have no influence on how Java 2D and/or LWJGL are handling things, I'm afraid. Have you tried to disable Java 2D's OpenGL/D3D pipeline?
#8
Support / Re: Problem with AWTGLCanvas
August 29, 2025, 10:19:07 AM
I've moved the question into a new topic, just in case you are wondering.

I'm not aware of a problem with the location of AWTGLCanvas but then again, I've never really used it in situations where it doesn't use the whole frame. So I never tried to use it as part of an actual UI.

Have to tried to disable Java2D's accelerated rendering pipeline? Maybe it's a problem with that (albeit I doubt it, but it might be worth a try).
#9
Projects / Re: Sky Maze 3D
April 09, 2025, 09:47:54 AM
Nice to see you back in action. Game is still looking great and runs fine in Chrome.
#10
Support / Re: Is there any magic to compile(true)?
March 06, 2025, 06:53:09 AM
Can you provide a test case that shows that it works uncompiled not not compiled? So that I can see what's actually wrong? I assume that it's a kind of configuration issue, but it's hard to tell without knowing what the actual problem looks like.
#11
Support / Re: Is there any magic to compile(true)?
February 27, 2025, 09:11:53 AM
How are you applying your animation? In an IVertexController or in some other way?
#12
Support / Re: Is there any magic to compile(true)?
February 26, 2025, 06:33:46 AM
compile(true) compiles the object to use client side data for the GPU (i.e. it resides in the system's memory) while (false) compiles it to use server side memory (i.e. on the GPU). The former is more suitable for objects that change after compilation while the latter is faster for static objects. Have to tried to compiled it with (true) and indexing disabled?
#13
Support / Re: Software Render Color Depth
February 26, 2025, 06:29:10 AM
That's because the GL renderer discards a texture's actual pixel data once it has been uploaded to the GPU. There's a 'keepPixelData()' method in Texture to prevent this.
#14
Support / Re: Software Render Color Depth
February 19, 2025, 06:58:07 AM
Yes, a little bit...  ;) It's actually a performance issue. The "old" transparency code is optimized for speed and not accuracy, which is why its results are  not on par with what the GL renderer could do. The alpha stuff has been added much later. It's more flexible but also slower.
#15
Support / Re: Software Render Color Depth
February 13, 2025, 07:54:51 AM
setAlpha really means the alpha value as it's represented in the texture, i.e. shifted up by 24. Here's an example of how it works:

import java.awt.*;
import java.awt.event.*;
import com.threed.jpct.*;

public class Transparency extends Frame implements WindowListener {
    private World theWorld;
    private FrameBuffer buffer;
    private Camera cam;
    private Object3D obj;
    private boolean keepGoing, turnRight, turnLeft;
    private com.threed.jpct.util.KeyMapper keyMapper;
    private Texture boxMap;
    private int transparency = 0;

    public Transparency() {
      this.setTitle("BR's");
      theWorld = new World();
      buffer = new FrameBuffer(1440, 900, FrameBuffer.SAMPLINGMODE_NORMAL);
      obj = com.threed.jpct.util.ExtendedPrimitives.createBox(new SimpleVector(2f, 2f, 2f));//Primitives.getCube(1f);
      TextureManager.getInstance().addTexture("boxMap", (boxMap=new Texture("test.jpg", true)));
      obj.setTexture("boxMap");
      obj.setTransparency(0);
      //obj.setTransparencyMode(Object3D.TRANSPARENCY_MODE_ADD);
      obj.build();
      Object3D backgroundPlane = Primitives.getPlane(1, 4f);
      backgroundPlane.build();
      backgroundPlane.translate(0f, -2f, 0f);
      theWorld.addObject(backgroundPlane);
      cam = theWorld.getCamera();
      cam.moveCamera(Camera.CAMERA_MOVEOUT, 8f);
      theWorld.addObject(obj);
      theWorld.setAmbientLight(255, 255, 255);
      keyMapper = new com.threed.jpct.util.KeyMapper(this);
      this.addWindowListener(this);
      this.setSize(buffer.getWidth(), buffer.getHeight());
      this.setVisible(true);
      loop();
    }

    public void loop() {
      keepGoing = true;
      transparency=0;
      int dir = 1;
      int its= 0;
      while (keepGoing) {
          buffer.clear();
          com.threed.jpct.util.KeyState keyState = keyMapper.poll();
          if (keyState.getState() == com.threed.jpct.util.KeyState.PRESSED)
              keyPressed(keyState.getKeyCode());
          else if (keyState.getState() == com.threed.jpct.util.KeyState.RELEASED)
              keyReleased(keyState.getKeyCode());
          if (turnRight)
              obj.rotateY(-.01f);
          if (turnLeft)
              obj.rotateY(.01f);
          theWorld.renderScene(buffer);
          theWorld.draw(buffer);
          //theWorld.drawWireframe(buffer, Color.yellow);
          buffer.display(this.getGraphics());
          its++;
              if (its>10)  {
              transparency+=dir;
              if (Math.abs(transparency)>255 || transparency==0) {
                  dir*=-1;
              }
              //obj.setTransparency(transparency);
              TextureManager.getInstance().getTexture("boxMap").setAlpha(transparency<<24);
              System.out.println("Trans: "+transparency);
              its = 0;
          }
          Thread.yield();
      }
      buffer.dispose();
      this.dispose();
      System.exit(0);
    }

    private void keyPressed(int keyCode) {
      if (keyCode == KeyEvent.VK_RIGHT)
          turnRight = true;
      if (keyCode == KeyEvent.VK_LEFT)
          turnLeft = true;
    }
    private void keyReleased(int keyCode) {
      if (keyCode == KeyEvent.VK_RIGHT)
          turnRight = false;
      if (keyCode == KeyEvent.VK_LEFT)
          turnLeft = false;
    }
    public void windowClosing(WindowEvent e) {
      keepGoing = false;
    }
    public void windowClosed(WindowEvent e) {}
    public void windowOpened(WindowEvent e) {}
    public void windowActivated(WindowEvent e) {}
    public void windowDeactivated(WindowEvent e) {}
    public void windowIconified(WindowEvent e) {}
    public void windowDeiconified(WindowEvent e) {}

    public static void main(String[] args) {
      new Transparency();
    }
}