Hello,
I'm having a bit of trouble rendering a quad with exactly 1px border but can't figure out for the life of me how to do it. I'm using basic vertex and pixel shaders where the position I pass in is in clip space. I thought this would do the trick:
float dx = 1.0f / static_cast<float>(width_);
float dy = 1.0f / static_cast<float>(height_);
D3DXVECTOR2 coords[6] = {D3DXVECTOR2(-1.0f + dx, -1.0f + dy), D3DXVECTOR2(-1.0f + dx, 1.0f - dy), D3DXVECTOR2(1.0f - dx, 1.0f - dy),
D3DXVECTOR2(-1.0f + dx, -1.0f + dy), D3DXVECTOR2(1.0f - dx, 1.0f - dy), D3DXVECTOR2(1.0f - dx, -1.0f + dy)};
When I use 2.0f * dx or 2.0f * dy I get a 2px border everywhere. Which I guess means my method should be correct? I'm really confused...
Thanks in advance!