hello every one ,
i have this code here
Dim desc = New SwapChainDescription() With {
.BufferCount = 1,
.ModeDescription = New ModeDescription(m_rendrform.ClientSize.Width,
m_rendrform.ClientSize.Height,
New Rational(60, 1),
Format.R8G8B8A8_UNorm),
.IsWindowed = True,
.OutputHandle = m_rendrform.Handle,
.SampleDescription = New SampleDescription(1, 0),
.SwapEffect = SwapEffect.Discard,
.Usage = Usage.RenderTargetOutput}
' Create our device with swap chain and get the device context
Direct3D11.Device.CreateWithSwapChain(DriverType.Hardware,
DeviceCreationFlags.None,
desc,
_d3d11Device,
_swapChain)
_d3d11DevCon = _d3d11Device.ImmediateContext
_factory = _swapChain.GetParent(Of Factory)()
_factory.MakeWindowAssociation(m_rendrform.Handle, WindowAssociationFlags.IgnoreAll)
' New RenderTargetView from the backbuffer
backBuffer = Texture2D.FromSwapChain(Of Texture2D)(_swapChain, 0)
_renderTargetView = New RenderTargetView(_d3d11Device, backBuffer)
' Compile Vertex and Pixel shaders
vertexShaderByteCode = ShaderBytecode.CompileFromFile("MyPointsShaders.fx", "VS", "vs_4_0", ShaderFlags.None, EffectFlags.None)
vertexShader = New VertexShader(_d3d11Device, vertexShaderByteCode)
pixelShaderByteCode = ShaderBytecode.CompileFromFile("MyPointsShaders.fx", "PS", "ps_4_0", ShaderFlags.None, EffectFlags.None)
pixelShader = New PixelShader(_d3d11Device, pixelShaderByteCode)
' Layout from VertexShader input signature
layout = New InputLayout(_d3d11Device,
ShaderSignature.GetInputSignature(vertexShaderByteCode),
{New InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
New InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0)})
' Instantiate Vertex buiffer from vertex data
vertices = Direct3D11.Buffer.Create(
_d3d11Device,
BindFlags.VertexBuffer,
{New Vector4(0.0F, 0.5F, 0.5F, 1.0F), New Vector4(1.0F, 0.0F, 0.0F, 1.0F),
New Vector4(0.5F, -0.5F, 0.5F, 1.0F), New Vector4(0.0F, 1.0F, 0.0F, 1.0F),
New Vector4(-0.5F, -0.5F, 0.5F, 1.0F), New Vector4(0.0F, 0.0F, 1.0F, 1.0F)})
' Prepare All the stages
_d3d11DevCon.InputAssembler.InputLayout = layout
_d3d11DevCon.InputAssembler.PrimitiveTopology = PrimitiveTopology.PointList
_d3d11DevCon.InputAssembler.SetVertexBuffers(0, New VertexBufferBinding(vertices, 32, 0))
_d3d11DevCon.VertexShader.Set(vertexShader)
_d3d11DevCon.Rasterizer.SetViewport(New Viewport(0,
0,
m_rendrform.ClientSize.Width,
m_rendrform.ClientSize.Height,
0.0F, 1.0F))
_d3d11DevCon.PixelShader.Set(pixelShader)
_d3d11DevCon.OutputMerger.SetTargets(_renderTargetView)
this simply shows a black screen with a red dot on it (you can hardly see it)
so i have some questions :
1 - how to change location of the dot
2 - how to change color of the dot
3 - what are the pieces of the code that i posted that are responsible for "Drawing" objects
4 - how to change the black background
5 - are there any helpful tutorials for sharpdx with D3D11 ?