Hello,
I’m trying to pass a depth buffer to one of my shaders and I’m having some trouble. In the shader, if I print out texture2D(m_DepthBuffer,coords) some text are displayed at the top of the screen. Help would be much appreciated.
With this code I try to get the depth buffer:
[java]
int w = app.getCamera().getWidth();
int h = app.getCamera().getHeight();
FrameBuffer zBuffer = new FrameBuffer(w, h, 0);
zBuffer.setDepthBuffer(Format.Depth);
depthBufferTexture = new Texture2D(w, h, Format.Depth);
zBuffer.setDepthTexture(depthBufferTexture);
depthView = getRenderManager().createPreView(“depthView”, cam);
depthView.setOutputFrameBuffer(zBuffer);
depthView.attachScene(rootNode);
[/java]
And I do this when passing it to my shader:
[java]
material.setTexture(“DepthBuffer”, depthBufferTexture);
[/java]