Hot answers tagged c++
Your input layout defines POSITION as R32G32B32_FLOAT but Vertex's first member is an XMFloat4. This results in garbage in the TEX input. To fix the problem, switch to a XMFloat3 for the Vertex position member. Also, the offset for your NORMAL is set to zero - this should be D3D11_APPEND_ALIGNED_ELEMENT as well.
You are blocking on pollEvent. window.PollEvent is for handing events, not your draw loop. Since you are looking at the keypresses every frame, you can't do it in the event handling - it is only trigger on the actual keypress events (which you are now ignoring, which is fine). Move it into the draw loop. Take a look at this sample: ...
You can't rewrite that loop so that it can't be unrolled. GPUs do not in general support a varying number of attributes to be passed between stages. You can, however, eliminate the loop entirely. Just pass vPosWS to the fragment shader, and do the loop there. Then the unrolling will actually be helpful. Bonus: You don't waste an absurd amount of bandwidth ...
I'm not sure, but you probably should move code that sets color of light to update frame. As I understand you initialize light color only once at start of program, but it needs to be updated each frame, in accordance with this question.
The normals facing away from the camera are shaded black in your setup. Add more lights into the scene that are shining on parts you want lit up, or set up the lighting with a brighter minimum brightness.
This should be a comment but I cant make them :(. Anyhow it looks like a normals problem with your model. If you look at the bottom flower in the first picture the lighting is wrong and it looks like the light is coming from behind and above the flower instead of in front it. Try to set the color of each pixel to the value of normal to see if the normals ...
Only top voted, non community-wiki answers of a minimum length are eligible