Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

117 Neutral

About LegendInStone

  • Rank
  1. LegendInStone

    weird problem when iniliseing pointers directx

    I think you want Create(UINT width , UINT height , ID3D10Texture2D* (&texture), ID3D10RenderTargetView* (&targetview), ID3D10ShaderResourceView* (&resourseView)), so the pointers are passed by reference. Though I can't tell exactly what you need to be passed by reference, since the formatting of your code seems to be broken.
  2. LPCSTR is a pointer to a character array, so in the first piece of code you are basically adding &line to the vector everytime (and thus every item will have the same value). The second piece of code works because you add different pointers (1 of 20) to the vector each time. You should use the string type instead of LPCSTR. Edit: clarity
  3. LegendInStone

    Fastest way to draw connected lines?

    I had read somewhere that creating the brushes is very minimal.. but wasn't sure about the path geometry. I modified it and still get 24 or 25 FPS. private void button1_Click(object sender, EventArgs e) { Stopwatch sw = new Stopwatch(); sw.Start(); SharpDX.Direct2D1.PathGeometry geometry = new SharpDX.Direct2D1.PathGeometry(d2dFactory_SharpDX); SharpDX.Direct2D1.GeometrySink sink = geometry.Open(); sink.BeginFigure(new PointF(0, 0), new SharpDX.Direct2D1.FigureBegin()); sink.AddLines(pts[0]); sink.EndFigure(new SharpDX.Direct2D1.FigureEnd()); sink.Close(); SharpDX.Direct2D1.SolidColorBrush brush = new SharpDX.Direct2D1.SolidColorBrush( renderTarget_SharpDX, new SharpDX.Color4(255, 255, 255, 255)); int frames = 0; while (sw.ElapsedMilliseconds < 1000) { renderTarget_SharpDX.BeginDraw(); renderTarget_SharpDX.Clear(new SharpDX.Color4(255, 0, 0, 0)); renderTarget_SharpDX.DrawGeometry(geometry, brush); renderTarget_SharpDX.EndDraw(); frames++; swapChain_SharpDX.Present(0, SharpDX.DXGI.PresentFlags.None); } brush.Dispose(); geometry.Dispose(); MessageBox.Show("D2D Frames: " + frames); } [/quote] I would recommend moving sw.Start() to just before the while loop since time will elapsed during your setup before the loop (though I can't gaurantee how much that will help)
  4. LegendInStone

    delta time acceleration

    Looks about right to me Edit: make sure abs(xVel) approaches zero so that you don't suddenly start moving in another direction after letting go of an arrow key
  5. LegendInStone

    delta time acceleration

    Should be as simple as adding an acceleration variable based on direction/throttle i.e. xVel += xAcc * (dt / 1000) x += xVel * (dt / 1000)
  6. LegendInStone

    Color blending shader

    Output = lerp(pln.BackgroundColor, float4(pln.LetterColor.rgb, 1.0f), DiffuseSample.r * pln.LetterColor.a) should also work for that and will simplify your code a bit edit: got something backwards again
  7. LegendInStone

    Color blending shader

    If your texture is just a grayscale, why not use a single channel of it as the weight parameter for a lerp between the background colour and text colour? ie return lerp( BackgroundColor, LetterColor, DiffuseSample.r)? edit: got parameters backwards
  8. Check the HRESULT returned by D3D11CreateDeviceAndSwapChain in case it is failing, Also passing D3D11_CREATE_DEVICE_DEBUG to the flags parameter may give more information in the output about what is going wrong
  9. LegendInStone

    [DirectX11] Multiple Render Target

    This is the code sequence: // Set render targets ID3D11RenderTargetView* renderTargetViewArray[3] = { g_colorRenderTarget->GetRenderTarget(), g_normalRenderTarget->GetRenderTarget(), g_depthRenderTarget->GetRenderTarget() }; ID3D11DepthStencilView* depthStencilView = DXUTGetD3D11DepthStencilView(); i_deviceContext->OMSetRenderTargets(3, renderTargetViewArray, depthStencilView); // Clear render targets const float clearColor[4] = {0.f, 0.f, 0.f, 0.f}; g_colorRenderTarget->Clear(i_deviceContext, clearColor); const float clearNormal[4] = {0.5f, 0.5f, 0.5f, 0.f}; g_normalRenderTarget->Clear(i_deviceContext, clearNormal); const float clearDepth[1] = {1.f}; g_depthRenderTarget->Clear(i_deviceContext, clearDepth); i_deviceContext->ClearDepthStencilView(DXUTGetD3D11DepthStencilView(), D3D11_CLEAR_DEPTH, 1.0, 0); // Draw Scene g_RenderGBufferEffect->GetVariableByName("World")->AsMatrix()->SetMatrix(g_WorldCube); g_RenderGBufferEffect->GetVariableByName("View")->AsMatrix()->SetMatrix((float*) &g_View); g_RenderGBufferEffect->GetVariableByName("Projection")->AsMatrix()->SetMatrix((float*) &g_Projection); SetMaterial(g_MaterialCube); i_deviceContext->IASetInputLayout(g_pVertexLayout); i_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); const UINT stride = sizeof(SimpleVertex); const UINT offset = 0; i_deviceContext->IASetVertexBuffers(0, 1, &g_pVertexBufferCube, &stride, &offset); i_deviceContext->IASetIndexBuffer(g_pIndexBufferCube, DXGI_FORMAT_R32_UINT, 0); D3DX11_TECHNIQUE_DESC techDesc; g_RenderGBufferTechnique->GetDesc(&techDesc); for(UINT p = 0; p < techDesc.Passes; ++p) { g_RenderGBufferTechnique->GetPassByIndex(p)->Apply(0, i_deviceContext); i_deviceContext->DrawIndexed(36, 0, 0); } // Set and clear render target const float clearLight[4] = {0.f, 0.f, 0.f, 0.f}; ID3D11RenderTargetView* lightRenderTarget = g_lightRenderTarget->GetRenderTarget(); i_deviceContext->OMSetRenderTargets(1, &lightRenderTarget, NULL); g_lightRenderTarget->Clear(i_deviceContext, clearLight); // Draw g_pointLightEffect->GetVariableByName("colorTexture")->AsShaderResource()->SetResource(g_colorRenderTarget->GetResourceView()); g_pointLightEffect->GetVariableByName("normalTexture")->AsShaderResource()->SetResource(g_normalRenderTarget->GetResourceView()); g_pointLightEffect->GetVariableByName("depthTexture")->AsShaderResource()->SetResource(g_depthRenderTarget->GetResourceView()); i_deviceContext->IASetInputLayout(g_pointLightLayout); D3DX11_TECHNIQUE_DESC techDesc; g_pointLightTechnique->GetDesc( &techDesc ); for( UINT p = 0; p < techDesc.Passes; ++p ) { g_pointLightTechnique->GetPassByIndex( p )->Apply(0,i_deviceContext); g_MeshSphere.Render(i_deviceContext); } [/quote] With the provided code those textures will still be bound on the input stage when another frame is rendered; you will have to clear them from the shader before drawing the next frame.
  10. LegendInStone

    [DirectX11] Multiple Render Target

    You are likely using the texture resource(s) for those render targets for a shader, and still have them bound to that stage of the rendering pipeline. You can't have the resource bound for input and output at the same time in D3D11.
  11. LegendInStone

    Directx11 Debug Runtime

    Use D3D11_CREATE_DEVICE_DEBUG in the flags parameter with D3D11CreateDevice or D3D11CreateDeviceAndSwapChain
  12. LegendInStone

    How do they do it?

    Yes, I am trying to figure it out for my OpenGL game, do you know how? [/quote] Well, if you don't need anything translucent, then you could use the alpha channel and multiply it against the team colour in the pixel shader after disabling alpha blending
  13. LegendInStone

    [D3D11] Width/height of resource

    A call to ID3D11ShaderResourceView::GetResource, query that resource for ID3D11Texture2D and then ID3D11Texture2D::GetDesc should get you what you're looking for.
  14. LegendInStone

    Can someone test my game library?

    Try using float& (ie return a reference to the item) and you can assign to that.
  15. LegendInStone

    Confused about Constant Buffers [DX10]

    Under the assumption that Dx10 works similar to Dx11 (and you are using the effect framework) I'd have to say that GetVariableByName locks the buffer, set's the data at the variable's position and then unlocks it. Or perhaps instead, (since I don't use the effect framework myself) it keeps a local copy of the buffer in main memory and copy's to the constant buffer at some point. Regardless, Constant buffers are required to set constant data in the shader via PSSetConstantBuffers.
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!