Jump to content
  • Advertisement
Sign in to follow this  
garusher

NVidia SolidWireFrame

This topic is 996 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I'm wanting to display some geometries using the solidwireframe, it appears to be a fx file with multiple effects and single passes.

technique10 SolidWirePattern
    <string info = "SolidWirePattern : SolidWire with a dot line pattern on diagonal edges";>
{
    pass
    {
        SetDepthStencilState( DSSDepthLessEqual, 0 );
        SetRasterizerState( RSFill );
        SetBlendState( BSBlending, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );
        SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetGeometryShader( CompileShader( gs_4_0, GSSolidWire() ) );
        SetPixelShader( CompileShader( ps_4_0, PSSolidWirePattern() ) );
    }
}

can these be converted to HLSL format and called from Directx11.1 like this.

deviceContext->IASetInputLayout(m_vertexLayout);
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
SetDepthStencilState(deviceContext);
SetRasterizerState(deviceContext);
SetBlendState(deviceContext);
deviceContext->VSSetShader(m_vertexShader, NULL, 0);
deviceContext->GSSetShader(m_geometryShader, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0);

I thought i could do the following for SetDepthStencilState

D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
ZeroMemory(&depthStencilDesc, sizeof(depthStencilDesc));
depthStencilDesc.DepthEnable = true;
depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
HRESULT result = device->CreateDepthStencilState(&depthStencilDesc, &m_pdepthStencilState);

and SetRasterizerState

D3D11_RASTERIZER_DESC rasterDescription;
ZeroMemory(&rasterDescription, sizeof(D3D11_RASTERIZER_DESC));
rasterDescription.FillMode = D3D11_FILL_SOLID;
rasterDescription.CullMode = D3D11_CULL_NONE;
rasterDescription.DepthBias = 0;
rasterDescription.MultisampleEnable = TRUE;
HRESULT hr = device->CreateRasterizerState(&rasterDescription, &m_prasterState);

and SetBlendState

D3D11_BLEND_DESC blendStateDescription;
ZeroMemory(&blendStateDescription, sizeof(D3D11_BLEND_DESC));
blendStateDescription.RenderTarget[0].BlendEnable = TRUE;
blendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
blendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
blendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_DEST_ALPHA;
blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blendStateDescription.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
HRESULT result = device->CreateBlendState(&blendStateDescription, &m_pblendingState);

Thanks

Gary

Edited by garusher

Share this post


Link to post
Share on other sites
Advertisement

I have not formally introduced myself to DX11, but if you are trying to draw a wireframe, why is your FillMode set to Solid, instead of Wireframe? The D3D11_FILL_WIREFRAME enum might make a little more sense for your rasterizer state.

Share this post


Link to post
Share on other sites

I have not formally introduced myself to DX11, but if you are trying to draw a wireframe, why is your FillMode set to Solid, instead of Wireframe?

Because it doesn't use the wireframe rendering but it generates geometry using a geometry shader.

Edited by Alundra

Share this post


Link to post
Share on other sites

 

I have not formally introduced myself to DX11, but if you are trying to draw a wireframe, why is your FillMode set to Solid, instead of Wireframe?

Because it doesn't use the wireframe rendering but it generates geometry using a geometry shader.

 

He says he is trying to set the data outside of the shader. But we are off topic and it seems this post has been ignored by the op. /thread

Share this post


Link to post
Share on other sites

Yes he only said he converted the effect to c++ which is good because it's not a good way to use the FX files with the effect lib because it contains memory leaks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!