Jump to content
  • Advertisement

Archived

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

BlackEye

Hold on ! Stop the boat!

This topic is 5453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Guest Anonymous Poster
you could draw a 1x1 sprite, or have drawprimitive just do 1 vertex.

Share this post


Link to post
Share on other sites
yeah, thanks i just saw the Setpixel function in my old lamothe book! And the brushes and pens GDI bit. Phew feel better now. Doesnt work to well with My DX app though, the pixels flicker?

Share this post


Link to post
Share on other sites
yeah, thanks i just saw the Setpixel function in my old lamothe book! And the brushes and pens GDI bit. Phew feel better now. Doesnt work to well with My DX app though, the pixels flicker?

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!