Mar
26
2009
0

My father… was a programmer… and a fiend…

Stencil BufferRecently I’ve been working on some functionality on one of my own games. The main problem I’ve been having is gDEBugger is no longer in the Beta stage for the Mac, and so my temporary license has run out. At some point I do plan to buy a license, but for the moment I’m limited to my own OpenGL debugging.

So I got inspiration to make a shader to render my stencil buffer for easier debugging. It works like this, after reading the stencil from my Frame Buffer Object (FBO), I render it to a fullscreen quad. During the Fragment Shader process, I read the pixel from the stencil texture, separating a single component (I choose red), I then use this to sample a pixel from a 1D texture (256 pixels wide since the stencil is 8bit, each with a unique colour).

Depth BufferThere are other applications I found for this, such as rendering the depth buffer as well, usually the depth buffer is practically white, and make it difficult to see objects far away. Of course, using many colours to do this, make it almost impossible to understand it. And because its a 1D 256 pixel texture, it doesn’t show the full range of depths since the depth buffer I’m using is 24bit.

It does demonstrate however how the depth buffer gets less accurate the further away an object is. the colours get further and further apart. This can be remedied by increase the number of bits a depth has, or reducing the difference between the near and far plane. Or you could do multiple renders (back to front) rendering the different distant objects, clearing the depth buffer after each render.

Though that is a little overkill. I do love the effect of the stencil buffer shader on the depth buffer though, reminds me of Commodore 64 crashes.

Written by Kaluriel in: Code, Courage, Programming | Tags: ,
Mar
17
2009
0

gDEBugger

gDEBuggerI’ve recently been taking part in beta testing the new gDEBugger for MacOSX. A fantastic program that for those who have used GPAD when developing for the PS3, or PIX when developing for the XBox360 will find familiar.

It gives details information about bottlenecks in your rendering, things that may be wrong, state changes that weren’t necessary, etc. And another useful thing, it allows you to view your textures, their mip maps, your frame buffers, and more importantly, depth and stencil buffers.

Today the license I was given expired since it is now out of beta and available to buy, though they were kind enough to give me a promotional code that would give me 15% off when I purchase.

I recommend it to any OpenGL developer, its helped improve my own game engine by showing me flaws in what I was doing.

Written by Kaluriel in: Code, Programming | Tags: ,

Theme: TheBuckmaker.com Blog Themes | The best Webhosting Plans, Eigenes Internet Radio