title: Most basic transformed vertex-drawing with Direct3D
body: <p>I'm absolutely new to DirectX and I'd like to draw some untransformed primitives with the most basic Direct3D configuration (for learning purposes). I already drew some primitives with transformed vertices, that is vertices with the D3DFVF_XYZRHW flag set.</p>
  
  <p>Now I'm trying to get the same output with untransformed vertices, but I don't get any visuals on the screen. I changed my FVF and adjusted the vertices but didn't set any transformation matrix (world, view, projection) yet. Is it necessary to set any of those matrices? I'd assume that everything would work just like with transformed vertices when no matrices are set, but obviously that's not the case.</p>
  
  <p>What area (in world-coordinates) is visible by default? What do I have to do in order to make it work?</p>
  
  <p>This is basically what I do:</p>
  
  <pre><code>struct Vertex
  {
      float x, y, z;
      D3DCOLOR color;
  
      static const DWORD format = D3DFVF_XYZ | D3DFVF_DIFFUSE;
  };
  
  
  const Vertex vertices[] =  {
                             {0.0f, 0.8f, 0.5f, D3DCOLOR_XRGB(255, 255, 255)},
                             {0.8f, -0.8f, 0.5f, D3DCOLOR_XRGB(255, 255, 255)},
                             {-0.8f, -0.8f, 0.5f, D3DCOLOR_XRGB(255, 255, 255)}
                             };
  
  
  pd3dDevice-&gt;CreateVertexBuffer(sizeof(vertices), 0, Vertex::format, D3DPOOL_DEFAULT, &amp;pVB, NULL);
  
  VOID* vertexData = 0;
  pVB-&gt;Lock(0, sizeof(vertices), &amp;vertexData, 0);
  memcpy(vertexData, vertices, sizeof(vertices));
  pVB-&gt;Unlock();
  
  
  
  D3DMATRIX matrixIdentitiy;
  ZeroMemory(&amp;matrixIdentitiy, sizeof(matrixIdentitiy));
  matrixIdentitiy._11 = 1.0f;
  matrixIdentitiy._22 = 1.0f;
  matrixIdentitiy._33 = 1.0f;
  matrixIdentitiy._44 = 1.0f;
  
  pd3dDevice-&gt;SetTransform(D3DTS_WORLD, &amp;matrixIdentitiy);
  pd3dDevice-&gt;SetTransform(D3DTS_VIEW, &amp;matrixIdentitiy);
  pd3dDevice-&gt;SetTransform(D3DTS_PROJECTION, &amp;matrixIdentitiy);
  
  
  
  pd3dDevice-&gt;Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 0.0f, 0);
  pd3dDevice-&gt;BeginScene();
  
  pd3dDevice-&gt;SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
  pd3dDevice-&gt;SetRenderState(D3DRS_CLIPPING, FALSE);
  pd3dDevice-&gt;SetRenderState( D3DRS_ZFUNC, D3DCMP_ALWAYS );
  
  pd3dDevice-&gt;SetStreamSource(0, pVB, 0, sizeof(Vertex));
  pd3dDevice-&gt;SetFVF(Vertex::format);
  pd3dDevice-&gt;DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
  
  pd3dDevice-&gt;EndScene();
  pd3dDevice-&gt;Present(NULL, NULL, NULL, NULL);
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT: Now i got it, lighting was enabled, stupid beginner's mistake. Thanks for your help anyway!</p>