Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.




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;
share|improve this question

1 Answer 1

up vote 2 down vote accepted

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!

share|improve this answer
+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. – doppelgreener May 13 '11 at 0:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.