0
\$\begingroup\$

I know yall are probably going to hate me.....but I can't figure out what im doing wrong, im trying to make a SIMPLE Vertex Grid (for Terrain) but I get a black screen for some reason And I can't figure out why. It does run, but I just get a black screen afterwards....I hate posting such huge code on this site but I figure if anyone can explain what the heck I did wrong i'd be able to understand a little bit better.

I think the problem....may be in the matrix, but my code is simple and im 100% sure im doing the Grid right because I took it from a working tutorial that does grids (but it's large and VERY confusing for a beginner, so I just took the appropriate code).

I know it's alot to look at (vars.h is very small) and main.cpp is pretty small too but I know it's still alot.....but im just completely stuck.

vars.h http://pastebin.com/SupcqB8N

main.cpp http://pastebin.com/vAnSUTpp

shaders.hlsl

cbuffer ConstantBuffer { float4x4 matFinal; } struct VOut { float4 position : SV_POSITION; float4 color : COLOR; }; VOut VShader(float4 position : POSITION, float4 color : COLOR) { VOut output; output.position = mul(matFinal, position); output.color = color; return output; } float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET { return color; } 
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Have you tried building up from example code you know works? Incrementally adding to it? I think that's your best solution. Start with drawing a triangle and make sure that shows up, then add textures, then make it two triangles drawn from a loop, then make it into your whole grid.

For your current code, I can only suggest the basic 3D troubleshooting stuff.

  • Make sure your camera is pointing the right direction

  • Disable lighting, depth buffer, clipping, textures and special effects

  • Check that your objects are properly formed

  • Make sure your camera has it's bounds set up correctly

    Good luck!

\$\endgroup\$
1
  • 2
    \$\begingroup\$ +1 When implementing something grand, taking incremental steps from something tiny is always incredibly helpful. In every single step, you have only a tiny amount of code that might not be working, so identifying any problems that appear in each step is easy. \$\endgroup\$ Commented May 13, 2011 at 0:21

You must log in to answer this question.