Archived

This topic is now archived and is closed to further replies.

BlackEye

Hold on ! Stop the boat!

Recommended Posts

Hold on ! I have been working on a game using DirectX8 for months now, its getting close to completion now. I use sprites and rotate, transform and all the trimmings. BUT somewhere i have missed something! HOW THE HELL DO I JUST DRAW A SINGLE PIXEL !! I mean using Direct X or not!? errrr I dont know! Im sure you guys do. So whats the easiest way to just draw a pixel of a set colour somewhere on screen? Using DX or GDI Im scared i have overlooked this! Whar else have i missed, even D3D tutorials start with triangles!?

Share this post


Link to post
Share on other sites
DirectX:

Drawing a pixel somewhere on the screen requires you to access directly the surface memory of the back buffer, which in turn requires data transfers from and to the graphics card. Such operations will (usually) lose you all the benefits of accelerated 3d, and as such it''s not advisable.

A way to get around this is to draw a pointlist in transformed mode, where each vertex has it''s own position and color. This should result in pixels being written to the screen, approximately where you want them.

GDI:

Don''t know.

Share this post


Link to post
Share on other sites
And if you really need pure 2d functionality:


  1. Create a texture of desired size.

  2. Lock it; you''ll get a raw data pointer in which you can draw.

  3. Draw 2d stuff using any algorithm you like. Note that you have to implement the whole drawing yourself.

  4. Unlock the texture.

  5. Either blit or render the texture to the backbuffer. Rendering is faster in almost all cases (except for very small blits).



Note that in dx9, you can get a DC for your Direct3D surfaces, so that you can use Windows'' drawing functions. (I know you''re using 8 for now )

kind rgds,
-Nik

Share this post


Link to post
Share on other sites