title: Direct video buffer access
body: <p>when I comes to rendering things on screen using video card, only three options are available, if I understand correctly. These are</p>
  
  <ol>
  <li>DirectX (or XNA)</li>
  <li>OpenGL</li>
  <li>Windows Driver Kit and creating minimal implementation of graphics driver</li>
  </ol>
  
  <p>I have very little experience with DirectX or OpenGL, but from what I know you have to write a pixel shader program that tells rendering pipeline what to do with each pixel. These shaders are programmed in HLSL. But as far as I know, neither DirectX, nor OpenGL is able to return a pointer to a memory that I could write some <code>byte[]</code> buffer to from my C# program and get it rendered. Or am I mistaken here?</p>
  
  <p>WDK might be a better choice, because it would be possible to implement absolutely minimal implementation of graphics driver that does nothing but returns pointer to a memory where I could write RGB data. So at one hand I could get rid of all the abstraction DirectX or OpenGL provides (and which I don't need), but at the other complexity of driver development is not exactly a time-saver.</p>
  
  <p>Also, from what I have found while searching more information on this, in the old days of DOS there was an address 0B00 or similar that allowed developers to draw directly onto screen buffer. It's gone of course and no longer usable I guess, but I have read for compatibility reasons this memory spaces are still reserved. Is it possible to utilize this somehow?</p>
  
  <p>What is the easiest way to get access to video memory from C# so I can write directly onto screen? Does DirectX or OpenGL provide such functionality, that would enable me to directly copy and array of bytes <em>somewhere</em> and get it rendered?</p>