depth buffer

im wondering what im doing wrong. so, i want to read the depth buffer information and get them out in a shader (texture). all what im doing is to create a depth buffer and punching this buffer into a texture. but i dont receive any informations in the shader. whats wrong?



here a snips from my rttMANAGER modul:

bufferINFO = [1,1];

var rttBUFFER = [];
var rttTEXTURE = [];
function initTF_buffer(id,resX,resY,bufferINFO) {
	//bufferINFO = [0] -> buffers, [1] -> fboTYPES
	rttBUFFER[id] = gl.createFramebuffer();
	gl.bindFramebuffer(gl.FRAMEBUFFER, rttBUFFER[id]);
	rttBUFFER[id].width = resX;
	rttBUFFER[id].height = resY;

	var rttBUFFER_depth = gl.createRenderbuffer();
	gl.bindRenderbuffer(gl.RENDERBUFFER, rttBUFFER_depth);
	gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, rttBUFFER[id].width, rttBUFFER[id].height);
	gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, rttBUFFER_depth);
	var buffers = [
	var fboTYPES = [

function createBUFFER_texture(id,buffer,bufferTYPE,resX,resY){
	buffer.width = resX;
	buffer.height = resY;
	rttTEXTURE[id] = gl.createTexture();
	gl.bindTexture(gl.TEXTURE_2D, rttTEXTURE[id]);
	gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
	gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, buffer.width, buffer.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
	gl.framebufferTexture2D(gl.FRAMEBUFFER,bufferTYPE,gl.TEXTURE_2D, rttTEXTURE[id], 0);
	gl.bindTexture(gl.TEXTURE_2D, null);
	gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, buffer.width, buffer.height);
	gl.bindRenderbuffer(gl.RENDERBUFFER, null);
	gl.bindFramebuffer(gl.FRAMEBUFFER, null);

oops i forgot the maintain, im using a different way now. (like i used to before, just in the shaders)

maybe you are interested into the developing process about LSD.

LSD is an hobby project of mine, which should make it possible for me to display 3D content in WEB. regular im digital artist, with an bit of dirve to hobby programming. of course there some webgl frame works and engines already around. but i thought me, hey i want to crack this nut by myself :smiley: and in the meantime, i got an quiet nice working framework together. of course there still lot of useless and none elegance solutions in. currently im planing a change, which should bring more elegance into.

i hope im getting the next stable release finished with the end of the next month.

developer and fun blog :wink:

here you can see the engine in action:

stay tuned

It’s usually easier to help if you can post a working sample in something like or

As for reading the depth buffer values one way is to use the WEBGL_depth_buffer extension. There’s a test for it here. It supported in Chrome. I’m not sure if Firefox has added support yet. … xture.html

The test makes a depth textures, uses the depth texture as a depth buffer, then renders with the depth texture (using it as regular texture). And checks the values.

Thanks greggman, [u]mackeeper coupon code[/u]
[u]green smoke coupons[/u] [u]los angeles locksmith[/u]
I didn’t know you could test the depth bufffer, that would have come in handy on my last project but i’ve bookmarked it now incase i need it again :slight_smile:
[u]toronto locksmith[/u]