Results 1 to 5 of 5

Thread: depth buffer

  1. #1
    Junior Member
    Join Date
    Mar 2012

    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:
    Code :
    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);

  2. #2
    Junior Member
    Join Date
    Mar 2012

    Re: depth buffer

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

  3. #3
    Junior Member
    Join Date
    Mar 2012

    Re: depth buffer

    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 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

    here you can see the engine in action:

    stay tuned

  4. #4
    Junior Member
    Join Date
    Jan 2012

    Re: depth buffer

    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.

  5. #5
    Junior Member
    Join Date
    Dec 2012

    Re: depth buffer

    Thanks greggman, mackeeper coupon code
    green smoke coupons los angeles locksmith
    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
    toronto locksmith


Similar Threads

  1. Upside down depth buffer
    By remi_occipital in forum OpenGL ES general technical discussions
    Replies: 2
    Last Post: 12-05-2011, 03:18 AM
  2. gl-cl interop and depth buffer
    By whites11 in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 0
    Last Post: 05-11-2010, 12:01 PM
  3. Writing to depth buffer
    By grillsnusk in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 08-27-2008, 03:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts