4

when I comes to rendering things on screen using video card, only three options are available, if I understand correctly. These are

  1. DirectX (or XNA)
  2. OpenGL
  3. Windows Driver Kit and creating minimal implementation of graphics driver

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 byte[] buffer to from my C# program and get it rendered. Or am I mistaken here?

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.

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?

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 somewhere and get it rendered?

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • Are you trying to _draw_ to the screen or _capture_ from the screen? – Aesthete Aug 06 '12 at 12:40
  • I am trying to draw on the screen, write-only access, I don't need to read actual data in screen memory at all. –  Aug 06 '12 at 13:19
  • 1
    You might be better asking this on http://gamedev.stackexchange.com as there will probably be a higher concentration of people there who know about this kind of thing. – jcoder Aug 09 '12 at 11:34
  • @JohnB Thank you, I will try to ask there then. –  Aug 09 '12 at 15:03

1 Answers1

0

By using OpenGL's or Direct3D's built-in texture rendering capabilities, you can copy the pixel data from client side memory to server side memory and then have it render the texture on screen.

Note: With client side memory I mean the memory accessible from the program (on the CPU and in the RAM) and with server side memory I mean the memory on the graphics card. This has nothing to do with networking

Oskar
  • 1,321
  • 9
  • 19
  • I don't see anything in the question about client/server networking? – Aesthete Aug 06 '12 at 12:48
  • With client side memory I meant the memory accessible from the program (on the CPU and in the RAM) and with server side memory I meant the memory on the graphics card. This has nothing to do with networking. – Oskar Aug 06 '12 at 12:51
  • Ok well the graphics card isn't _serving_ anything so it's a little misleading. – Aesthete Aug 06 '12 at 12:59
  • It's a term. I'll edit the answer to prevent any future confusion. Thanks for the comment. – Oskar Aug 06 '12 at 13:00