Commit 301baa20 authored by chili's avatar chili
Browse files

8 bit per channel unorm

parent 7800295e
...@@ -106,17 +106,18 @@ void Graphics::DrawTestTriangle() ...@@ -106,17 +106,18 @@ void Graphics::DrawTestTriangle()
{ {
float x; float x;
float y; float y;
float r; unsigned char r;
float g; unsigned char g;
float b; unsigned char b;
unsigned char a;
}; };
// create vertex buffer (1 2d triangle at center of screen) // create vertex buffer (1 2d triangle at center of screen)
const Vertex vertices[] = const Vertex vertices[] =
{ {
{ 0.0f,0.5f,1.0f,0.0f,0.0f }, { 0.0f,0.5f,255,0,0,0 },
{ 0.5f,-0.5f,0.0f,1.0f,0.0f }, { 0.5f,-0.5f,0,255,0,0 },
{ -0.5f,-0.5f,0.0f,0.0f,1.0f }, { -0.5f,-0.5f,0,0,255,0 },
}; };
wrl::ComPtr<ID3D11Buffer> pVertexBuffer; wrl::ComPtr<ID3D11Buffer> pVertexBuffer;
D3D11_BUFFER_DESC bd = {}; D3D11_BUFFER_DESC bd = {};
...@@ -160,7 +161,7 @@ void Graphics::DrawTestTriangle() ...@@ -160,7 +161,7 @@ void Graphics::DrawTestTriangle()
const D3D11_INPUT_ELEMENT_DESC ied[] = const D3D11_INPUT_ELEMENT_DESC ied[] =
{ {
{ "Position",0,DXGI_FORMAT_R32G32_FLOAT,0,0,D3D11_INPUT_PER_VERTEX_DATA,0 }, { "Position",0,DXGI_FORMAT_R32G32_FLOAT,0,0,D3D11_INPUT_PER_VERTEX_DATA,0 },
{ "Color",0,DXGI_FORMAT_R32G32B32_FLOAT,0,8u,D3D11_INPUT_PER_VERTEX_DATA,0 }, { "Color",0,DXGI_FORMAT_R8G8B8A8_UNORM,0,8u,D3D11_INPUT_PER_VERTEX_DATA,0 },
}; };
GFX_THROW_INFO( pDevice->CreateInputLayout( GFX_THROW_INFO( pDevice->CreateInputLayout(
ied,(UINT)std::size( ied ), ied,(UINT)std::size( ied ),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment