Author Topic: Z-Buffer accessible  (Read 2884 times)

Offline Ravn

  • byte
  • *
  • Posts: 3
    • View Profile
Z-Buffer accessible
« on: February 22, 2005, 01:32:40 pm »
Hi everyone,

Do you know whether it is possible to access the z-Buffer in the jCPT engine? I know that it will probably not be possible when using hardware support as graphic cards usually do not (and physically can not) export it. How about software rendering? I'd like to use it for post-rendering graphical effects.

Thanks for any answers,
Best regards,
Ravn

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Z-Buffer accessible
« Reply #1 on: February 22, 2005, 08:09:08 pm »
It's not possible to do this in the current version, i'm afraid. Even in software mode, you would have to deal with the zTrick jPCT can use.  I don't think that i'll add a getZBuffer() method to FrameBuffer, but i can imagine to change the int[] that the zBuffer is protected. That way, you could access it, but only by extending FrameBuffer. That makes it clearer, that it's actually a hacky thing to do.
Would that help?

Offline Ravn

  • byte
  • *
  • Posts: 3
    • View Profile
Z-Buffer accessible
« Reply #2 on: February 23, 2005, 10:35:46 am »
I can not promise that it will, but it sounds good and I'd certainly like to try it. ;)
I am currently evaluating some other software renderers too, and still have to decide which one to use. But if you'd do me that favor with the zBuffer fleld, I will keep you informed of my progress in hacking the Framebuffer and any possible results.

Best regards,
Thomas

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Z-Buffer accessible
« Reply #3 on: February 23, 2005, 06:23:14 pm »
I've changed the field to protected in jPCT 1.05, which has been released today. To access it, do something like this:

Code: [Select]
import com.threed.jpct.*;

public class BetterBuffer extends FrameBuffer {

  public BetterBuffer(int x, int y, int os) {
    super(x,y,os);
  }

  public int[] getZBuffer() {
    return zbuffer;
  }
}


But remember: This is a somehow unsupported hack and it won't work with the OpenGL renderer.

Offline Ravn

  • byte
  • *
  • Posts: 3
    • View Profile
Z-Buffer accessible
« Reply #4 on: February 24, 2005, 10:16:49 am »
Thanks a lot!