// globals, set via constant table
uniform extern float4x4 MatWorld;
sampler2D TexSampler;
// Vertex shader input structure
// using a 2d engine so Position is float3
struct VS_INPUT
{
float4 Position : POSITION;
float2 Texture : TEXCOORD0;
};
// Vertex shader output structure
// Position converted to float4 for DX
struct VS_OUTPUT
{
float4 Position : POSITION;
float2 Texture : TEXCOORD0;
};
// **** VERTEX SHADER ****
VS_OUTPUT vs_main( in VS_INPUT In )
{
VS_OUTPUT Out = (VS_OUTPUT)0;
Out.Position = In.Position;
Out.Texture = In.Texture; //copy original texcoords
It renders my textures. I've debugged the Shader with Pix and it says the the VertexShader is doing what it's supposed to, but it doesn't draw anything and I think for some reason that when vs_main() is called ps_main() isn't.
You are missing position in your pixel shader. Your vertex shader outputs position and texcoords, but the pixel shader only takes a texcoord. Add Position and it should compile
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.
I think DX moves the vertices into 3d space differently when you translate in C++ using d3d_device->SetTransform() (which works) then if you translate using a shader.
I'll go back and make sure the ViewPort and Camera are set for 3d.
If the names of your variables are not misleading, you are transforming the vertex by the world matrix.
You must translate it by the world-view-projection matrix.
L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
But to be clear, These matrices can easily be combined into one, so that you do not waste cycles by performing 3 matrix multiplies.
It is best to compose a single matrix that represents all three of these transforms, and call it the WorldViewProjection matrix.
L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid