Z-Buffer accessible

Started by Ravn, February 22, 2005, 01:32:40 PM

Previous topic - Next topic

Ravn

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

EgonOlsen

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?

Ravn

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

EgonOlsen

I've changed the field to protected in jPCT 1.05, which has been released today. To access it, do something like this:

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.

Ravn