Jump to content
  • Advertisement
Sign in to follow this  
Absolution

Fastest way to set a pixel

This topic is 4307 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

What is the fastest way to set a pixel in a windows app? That is, what are my options if I just want direct control over the video memory in a fullscreen application? Is going with old school DirectDraw the best option? The GDI seems like it would be slow, and does it support fullscreen anyway? I basically want the lowest level control over the video memory (just to play around with blitting and such old school style.)

Share this post


Link to post
Share on other sites
Advertisement
Unless you are writing graphics card drivers, you can no longer have full control over the video memory like you used to in the old days.

The fastest way with GDI I've ever found to manipulate pixels is to create an array of RGBQUADs in normal memory, manipulate that then copy it to a device with SetDIBits.

I'm pretty sure (although not 100% on this) that even with DirectDraw, when you Lock(), it copies the surface into system memory, then copies it back when you Unlock(), so even that is not really direct access to the video memory.

You can't even directly access the video memory of a command-prompt console at 0xB8000000 like you used to be able to with 16 bit applications.

Share this post


Link to post
Share on other sites
What is the goal you wish to achieve? Want to write some kind of software renderer?
If so, you don't EVER call functions for setting individual pixels. You make dedicated functions for manipulating the buffer directly to draw horizontal line spans. Then you call this multiple times to draw a triangle etc.

I don't bother with DD in my software renderer yet. I just draw to a DIB and use the GDI to blit that to screen. DD would be better though.

Share this post


Link to post
Share on other sites
Ya, I realize I can no longer directly access the memory outside of kernel mode, I just wanted to know the fastest way to basically draw to a full screen window. The RGBQUADs array sounds like a simple and easy way. Thanks for the help.

Share this post


Link to post
Share on other sites
The fastest way to have a surface you can simply set pixels on is to use Direct3D/OpenGL and create a single texture to cover your entire screen. Lock/CopyTexSubImage the texture, then map it onto a single window sized quad.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!