• Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at \$59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!

Member Since 19 Dec 2007
Offline Last Active Nov 03 2014 06:54 AM

### Topics I've Started

17 September 2012 - 08:01 AM

Hi,

not strictly game programming but I recently released a live wallpaper for android.

The interesting part is it uses OpenGL ES 2.0 for rendering and has a realtime glass marbles/lens effect.

FREE:

PAID:

Also interested in knowing about compatibily issues with GLES 2.0...

### Synth tutorial, part 2

17 January 2010 - 08:39 AM

### Simple tone generator tutorial

23 December 2009 - 12:49 AM

Hi, I've been writing simple (actually very simple) tutorials on my personal website. I recently added a win32 tone generator tutorial. It's supposed to be the first part of a soft synth development tutorial. I'm not used to write tutorials or release source code, so I'm sorry if they aren't as good as you'd expect. If you want to give it a try here's the link. Feel free to drop a comment, here or on my website. Thank you!

### Crazy problem with stencil/depth in D3D10!!!!!

19 November 2009 - 09:27 PM

I'm currently working on a rendering pipeline who needs stencil buffer. I never had problems working with stencil in D3D9, but yesterday I spent a lot of time because the application output was very weird in D3D10. Premise: As chirality changes, the direction of the z coordinate changes. That means in a right handed coordinate system, my z-buffer is inverted, so the far plane is 0.0f and the near plane is 1.0f => all my depth tests are greater_equal istead of less_equal. It's not a problem for me since I can ask the rendering subsystem which kind of chirality is in use and setup the proper depth test. AFAIK, my math is right.. in the end this just works regardless of the API in use (D3D9 or D3D10). At a certain point in my pipeline I need to "reset" the stencil buffer. Since the application wasn't working and I didn't know why, I rearranged my pipeline so that I could reset the stencil buffer at the beginning of each frame just after clearing only depth, then disable stencil until I need it. Ok. The damn thing wasn't working. Tried outputting all informations from DX10 control panel, not a single warning. Everything looked fine. Started PIX, created a replayable stream. Inspected every single call and draw operation. It looked fine. I started playing with states on the shaders and discovered if I disabled depth test the thing worked!!!! WHY???? Ok, I had an horrible feeling and inverted the order of stencil and depth clear. Clear stencil, then clear depth. Everything is fine, also with depth test enabled!!! The problem is the following: when clearing the stencil buffer, I don't test the chirality because of course I'm not about to modify the "depth part" of the buffer.
```m_pD3D10Device->ClearDepthStencilView( m_pCurrentDepthStencil, D3D10_CLEAR_STENCIL, 1.0f, i_nStencilValue );
```
Apparently this function ALSO CLEARS THE DEPTH BUFFER WITH 1.0F REGARDLESS OF THE FACT I SPECIFIED D3D10_CLEAR_STENCIL!!!!!!!!!!!!!!!!!!!!!!!!! So I put my stencil clear function after the depth clear and I modified my code this way:
```if( !m_bLeftHanded ) // RH
m_pD3D10Device->ClearDepthStencilView( m_pCurrentDepthStencil,D3D10_CLEAR_STENCIL, 0.0f, i_nStencilValue );
else
m_pD3D10Device->ClearDepthStencilView( m_pCurrentDepthStencil, D3D10_CLEAR_STENCIL, 1.0f, i_nStencilValue );
```
Everything works fine. Do you have a clue about why is this thing happening? Have you ever experienced something like that?????

### [SOLVED] D3D10 RT/Texture already in use weird behaviour

09 November 2009 - 10:27 PM

Hi, I've lost a couple of hours yesterday because of the inability to set a RT while the texture was bound to a shader variable. The problem is I experienced a weird behaviour and I would like to know if you had similar issues or if you can shed some light. I fixed it, but I don't know why it works and I don't like this. The premise is the following: I have two render targets, each with his depthstencil surface. I have a two-stage rendering pipeline. The first pass (the PrePass) renders objects to the render targets (they are separated, so if I have a cube I draw it in the first RT then draw it again in the second) The second pipeline stage renders the scene and uses the render targets as textures. In brief: First stage ============ Set first RT Clear Render stuff Set second RT Clear Render Stuff Reset original RT Second stage ============= Clear For each object -Set first RT as texture input 1 -Set second RT as texture input 2 -draw -Unset first RT -Unset second RT end of object for Ok, it's not optimized. I know. In my implementation I have this code to set/unset textures, a function called SetShaderResource:
```return m_pEffect->GetVariableByName(i_szHandle)->AsShaderResource()->SetResource(i_pRV) == S_OK;
```
If i_pRV is null, the texture should be unbound. If I call the function this way it doesn't work:
```SetShaderResource(sSamplerName,NULL);
```
If I change my code, everything is fine:
```ID3D10ShaderResourceView * pSRV[1] = {NULL};