Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

An example from Frank D Luna's 3d Game Programming with Dx11 shows the following effect technique:

technique11 DrawTech
{
pass P0
{
    SetVertexShader(   CompileShader( vs_5_0, DrawVS() ) );
    SetGeometryShader( CompileShader( gs_5_0, DrawGS() ) );
    SetPixelShader(    CompileShader( ps_5_0, DrawPS() ) );

    SetBlendState(AdditiveBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xffffffff);
    SetDepthStencilState( NoDepthWrites, 0 );
}
}

Setting depth stencil state, blend states etc (and restoring them to previous state) when the Effects library isn't available is my goal.

I've had a hard time finding examples on this though. Luna sidesteps the issue by using the effects framework in his book.

To complicate the issue, I'm using DXUT11 (for loading in meshes).

Can anyone help with an example or an svn repository that includes an example?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

in the ID3D11DeviceContext, there is such function calls.

they are :
ID3D11DeviceContext::OMSetBlendState()
ID3D11DeviceContext::OMSetDepthStencilState()
ID3D11DeviceContext::OMSetRenderTargets()
ID3D11DeviceContext::OMSetRenderTargetsAndUnorderedAccessViews()

if you look at this website all of the things are listed here, and there you find how you use them and how they work.

http://msdn.microsoft.com/en-us/library/windows/desktop/ff476385(v=vs.85).aspx

for restoring to the last state, you have to have some kind of state machine implementation in your code, that stores the last used state. DX does not do this for you.

Eventualy, the effect library is using thees commands aswell, just that it has some extra stuff with it ( which i really hate ), so you can infact build your own effect system with this and use it more efficent than what you have in dx10/11.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.