Search Results

Search found 2 results on 1 pages for 'innochenti'.

Page 1/1 | 1 

  • Write depth buffer to texture

    - by innochenti
    I need to read depth buffer from GPU and write it to texture. How this can be done? Here is how texture for depth buffer is created: depthBufferDesc.Width = screenWidth; depthBufferDesc.Height = screenHeight; depthBufferDesc.MipLevels = 1; depthBufferDesc.ArraySize = 1; depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; depthBufferDesc.SampleDesc.Count = 1; depthBufferDesc.SampleDesc.Quality = 0; depthBufferDesc.Usage = D3D10_USAGE_DEFAULT; depthBufferDesc.BindFlags = D3D10_BIND_DEPTH_STENCIL; depthBufferDesc.CPUAccessFlags = 0; depthBufferDesc.MiscFlags = 0; m_device->CreateTexture2D(&depthBufferDesc, NULL, m_depthStencilBuffer); Also, I've got another question: is it possible to bind depth buffer texture as sampler to the pixel shader?

    Read the article

  • Multiple passes in direct3d10

    - by innochenti
    I begin to learning direct3d10 and stuck with multiple passes. As input I have a triangle(that stored in vb/ib) and effect file: //some vertex shader and globals goes there. skip them to preserve simplicity float4 ColorPixelShader(PixelInputType input) : SV_Target { return float4(1,0,0,0); } float4 ColorPixelShader1(PixelInputType input) : SV_Target { return float4(0,1,0,0); } technique10 ColorTechnique { pass pass0 { SetVertexShader(CompileShader(vs_4_0, ColorVertexShader())); SetPixelShader(CompileShader(ps_4_0, ColorPixelShader())); SetGeometryShader(NULL); } pass pass1 { SetVertexShader(CompileShader(vs_4_0, ColorVertexShader())); SetPixelShader(CompileShader(ps_4_0, ColorPixelShader1())); SetGeometryShader(NULL); } } And some render code: pass1->Apply(0); device->DrawIndexed(indexCount, 0, 0); pass2->Apply(0); device->DrawIndexed(indexCount, 0, 0); What I'd expect to see is the green triangle, but it always shows me red triangle. What am I doing wrong? Also, I've got another question - should I set vertex shader in every pass? I've added ColorVertexShader1 that translates vertex position by some delta, and 've got following picture: http://imgur.com/Oe7Qj

    Read the article

1