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: 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.
#2
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?
#3
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?
#4
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.
#5
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.
#6
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();
    }
}

#7
Support / Re: Software Render Color Depth
February 10, 2025, 06:48:51 AM
Either use a texture with no alpha channel and do setTransparency()...but that might look a bit coarse. Or use a texture with alpha and use Texture.setAlpha(). But that will alter the texture, which is slower and might not be feasible if you intend to do that on objects of which some are supposed to fade out while others won't.
#8
Support / Re: Software Render Color Depth
February 09, 2025, 02:07:09 PM
That's because the usage of alpha in the texture itself overrides the global transparency setting. Or in other words, if a texture uses an alpha channel, it doesn't allow for setting the global transparency using setTransparency(). IIRC, this is a limitation of the software renderer. However, transpancy using setTransparency is pretty coarse anyway. But that's not related to color depth but to the way in which it's applied.
#9
Support / Re: Software Render Color Depth
February 08, 2025, 11:23:37 AM
No, it's working on full 24 bit color depth.
#10
News / Re: Forum upgraded to 2.1.4
February 03, 2025, 04:31:12 PM
It should work now.
#11
News / Re: Forum upgraded to 2.1.4
February 03, 2025, 09:19:15 AM
I found the issue, but I can't fix it myself. I have to contact my provider.
#12
News / Re: Forum upgraded to 2.1.4
February 03, 2025, 09:00:13 AM
I see. That's a bit strange...the forum has a database user configured which works for everything else for some strange reason not for the search. I'm not sure why that it, I'll have a look and try to find something.
#13
Support / Re: Caching Animations in Software Rendering
January 30, 2025, 12:04:38 PM
It's nothing that I'm doing at least. I can only imagine that it's the JIT-compiler kicking in. Older VMs had the option to compile everything at startup. I'm not sure if this option is still available on newer ones but if it is, it might be worth to try to see if it fixes the problem. It might not be a good option in the end, because it hugely increases startup time, but to track down the problem, it might help.
#14
News / Re: Forum upgraded to 2.1.4
January 30, 2025, 12:02:13 PM
Never seen it and I got no error mail either. I had to upgrade the forum because of the old version being insecure and unspported. As long as it only happens every not and then, I guess we have to live with it.
#15
Support / Re: Caching Animations in Software Rendering
January 24, 2025, 09:18:44 AM
I'm not sure what you mean be "animations" in this context. There's nothing that "warms up" especially when using the software renderer. The only thing that I can think of is the VM itself. It might take some time to get up to speed with compiling the bytecode into native, but apart from trying to influence that behaviour with some VM switched, there's no way to change this.