Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Jun 2008
Offline Last Active Oct 16 2013 11:54 AM

Topics I've Started

Unix/Mac equivalent to GetKeyboardLayoutName?

19 February 2013 - 05:00 PM

Is there a unix and mac equivalent to the window's function GetKeyboardLayoutName, which retrieve's the system's active input locale identifier?  Thanks!

Integrating SFML into cross-platform engine with CMake

08 February 2013 - 01:02 PM

I'm creating a c++ game engine, and I intend to use SFML for the graphics, audio, and input.  I'm also using cmake to generate my build files, so that I have an easy way to test it across multiple OS'.  I'm wondering what the correct/proper approach is to integrating SFML into a setup like this.


Should I have a copy of the SFML libraries for each OS (win/unix/mac), and somehow specify in CMake which of the libraries to include?  Or do I include the SFML source into my project source and build the libraries along with my project?


My engine is building its own shared libraries and linking to those, so I understand the basics of this.  I'm just not sure how I should be including other people's libraries into my project, and making it so that it functions across multiple OS'.  Thanks.

[DX11] Shader not getting all instanced data

30 June 2011 - 10:56 AM

Edit: I just fixed it. In case anyone is curious the fix was, for polygonLayout[2] the AlignedByteOffset needs to be set to 12, since polygonLayout[1] is 12 bytes.

I have a simple shader that paints the pixels a color, and I'm trying to get this to work with instancing. My vertex layout contains the vertex position, the instanced object's position, and the instanced object's color. The objects appear in the correct position on the screen, so the instanced object's position is getting read correctly, however the color is not correct. My first thought is that I'm am incorrectly creating the vertex layout. Is this the correct way to do it for what I want?

  // Create the vertex input layout description.
  D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
	polygonLayout[0].SemanticName = "POSITION";
	polygonLayout[0].SemanticIndex = 0;
	polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
	polygonLayout[0].InputSlot = 0;
	polygonLayout[0].AlignedByteOffset = 0;
	polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
	polygonLayout[0].InstanceDataStepRate = 0;

	polygonLayout[1].SemanticName = "TEXCOORD";
	polygonLayout[1].SemanticIndex = 0;
	polygonLayout[1].Format = DXGI_FORMAT_R32G32B32_FLOAT;
	polygonLayout[1].InputSlot = 1;
	polygonLayout[1].AlignedByteOffset = 0;
	polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA;
	polygonLayout[1].InstanceDataStepRate = 1;

	polygonLayout[2].SemanticName = "TEXCOORD";
	polygonLayout[2].SemanticIndex = 1;
	polygonLayout[2].Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
	polygonLayout[2].InputSlot = 1;
	polygonLayout[2].AlignedByteOffset = 0;
	polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA;
	polygonLayout[2].InstanceDataStepRate = 1;

And inside my vertex shader the structure is,

struct VS_INPUT {
float4 position : POSITION;
float3 instPos : TEXCOORD0;
float4 instColor : TEXCOORD1;

[DX11] Unbinding render target for use in next pass

10 June 2011 - 02:43 PM

I'm running a shader that writes to both the back buffer and a render target. I would then like to run a second shader that uses that render target as an input texture. This is working fine in debug mode, but does not work in release mode. I have a feeling that I am not correctly unbinding the render target after the first pass. In DX9 you would do the following, pDevice->SetRenderTarget( 1, NULL ), to unbind your render target. Is there a DX11 equivalent to this?

I am currently doing the following:

// Set the back buffer and the one render target
pDeviceContext->OMSetRenderTargets( 2, rTargets, pDepthStencilView );

// Draw geometry

// Set the back buffer as the only target ( the render target in the above step will be used as an input texture
pDeviceContext->OMSetRenderTargets( 1, &pBackBufferView, pDepthStencilView );

// Do Stuff...the input texture is blank in release mode...okay in debug mode.

Thanks for any advice!

DirectX11 Help with Multiple Render Targets

09 June 2011 - 07:46 PM

I have had no luck all day trying to get multiple render targets to work. I have used them before in DirectX9 so the concept is not new, just the syntax. I keep getting an access violation error when calling OMSetRenderTargets. I would be very grateful if someone could point out the flaw in my logic. Here is the basic break down of what I'm doing,

ID3D11RenderTargetView* pRenderTargetView[2];

// Create the render target view with the back buffer pointer.
hr = pDevice->CreateRenderTargetView( pBackBuffer, NULL, &pRenderTargetView[0] );

hr = pDevice->CreateRenderTargetView( pRTargetTexture, &renderTargetViewDesc, &pRenderTargetView[1] );


pDeviceContext->OMSetRenderTargets( 2, pRenderTargetView, NULL );

pDeviceContext->ClearRenderTargetView( pRenderTargetView[0], clearColor );
pDeviceContext->ClearRenderTargetView( pRenderTargetView[1], clearColor );

// Draw Geometry

pSwapChain->Present(1, 0);