I'm interested in direct3d game programming and I'm just a beginner. I'm familiar with the Win32 API and i was wondering... how to put a certain pixel somewhere in the window is there like a function or anythting? thank you...
-
Welcome to CG. I would recommend starting with some DirectX tutorials. You can find plenty of them on the internet. Personally, I have never worked with DirectX, but with OpenGL. "Just drawing" a pixel requires you to do some rather complicated setup and to get a basic understanding of how modern graphic cards put the pixels onto your screen. So I am not sure if you will get an answer to your question that will be helpful to you. Also, we need more details about what you have done so far and what exactly the problem is you are facing. – wychmaster May 10 '21 at 18:00
-
I'd recommend googling for a "Hello triangle" example (for d3d of course), that will contain all that is needed to do basic setup and basic drawing – PaulHK May 11 '21 at 05:42
3 Answers
Normally, 3D rendering does not work by setting individual pixels but by passing a complete (facettized) geometric model to the rendering engine. This is why addressing a single pixel is not convenient and inefficient.
If you really want this, better use SetPixel
:-)
https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-setpixel
there is no direct way to place a pixel on a window I am afraid. An indirect way would be to draw a small quad equal to the size of a pixel in relation to your window
and essential y d3d 11 and 12 are most useful to draw geometry So I recommend you start from there and take your creativity ahead
If you want to draw pixels you can create a 2d texture resource and draw this texture to a fullscreen quad/triangle. After you set this up you can update the texture's pixels on the host site, update the texture and draw. If you specifically after this drawing method you can use Direct2D for this (D2D is a wrapper on D3D, so you don't need hundreds of lines of code to set this up).

- 1