Sign in to follow this  
Hassanbasil

DirectX 10 and input layouts

Recommended Posts

Hassanbasil    195
Hello everyone, So i've been starting with dx10 few days ago, i managed to draw some text on the screen and create some basic stuff, so the next thing on the list is created and rendering meshes, but i dont seem to get that input layout thing, does it mean that i MUST have at least one shader for my projects, than can do some basic stuff? that's awful..so anyway, here's what i'm doing:
void hxCore::Update ( void )
{
	_device->OMSetDepthStencilState ( 0, 0 );
	float blendFactors[] = { 0.0f, 0.0f, 0.0f, 0.0f };
	_device->OMSetBlendState ( 0, blendFactors, 0xffffffff );

	_device->ClearRenderTargetView ( _renderTarget, _clearColor );
	_device->ClearDepthStencilView ( _depthStencilView, D3D10_CLEAR_DEPTH | D3D10_CLEAR_STENCIL, 1.0f, 0 );

	//render objects
	for ( unsigned int i = 0; i < _ObjectV.size(); i++ )
		_ObjectV[i]->_Render ( );

	_swapChain->Present ( 0, 0 );
}

//object _Render() method
void hxObject::_Render ( void )
{
	if ( _vaild )
	{
		UINT stride = sizeof(_hxVertex2);
		UINT offset = 0;
		_MainCore->_device->IASetPrimitiveTopology ( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
		_MainCore->_device->IASetVertexBuffers ( 0, 1, &_VertexBuffer, &stride, &offset );
		_MainCore->_device->IASetIndexBuffer ( _IndexBuffer, DXGI_FORMAT_R32_UINT, 0 );

		_MainCore->_device->DrawIndexed ( _numFaces*3, 0, 0 );
	}
}



the object's vertex and index buffers are made correctly for that object, but it breaks at _MainCore->_device->DrawIndexed ( _numFaces*3, 0, 0 ), so it's caused because i did not create a vertex input layout, right? and to create one, i need a shader?

Share this post


Link to post
Share on other sites
DieterVW    724
DX10 is a shader only pipeline. You'll have to create an input layout and a vertex shader and a pixel shader in order to see anything. There are lots of tutorials with very simple shaders around so that part shouldn't be too much work.

Though the layouts are a little confusing, you can have one layout to use with many shaders.

Share this post


Link to post
Share on other sites
Hassanbasil    195
Quote:
Original post by DieterVW
DX10 is a shader only pipeline. You'll have to create an input layout and a vertex shader and a pixel shader in order to see anything. There are lots of tutorials with very simple shaders around so that part shouldn't be too much work.

Though the layouts are a little confusing, you can have one layout to use with many shaders.


Ahh that's depressing, Thanks for the info

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this