Jump to content
  • Advertisement
Sign in to follow this  
ed209

pixel

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

Advertisement
1. Define a vertex format
2. Create a vertex and vertex buffer
3. In your render loop, set the vertex buffer appropriately
4. In DrawUserPrimitive(), set the primitive type to D3DPT_POINTLIST

Share this post


Link to post
Share on other sites
Quote:
Original post by ed209
how do I draw a single pixel onto the screen?
By issuing a series of commands to the graphics API.

A more serious answer would be:
What language? What DirectX version? What API (D3D or DDraw)? Why do you want to draw a single pixel? Do you want to draw it once, or every frame? Do you want to only ever draw 1 pixel, or will you want to call your DrawPixel() function several times per frame? Are you sure you want to draw a pixel and not a more complex shape like a textured triangles?

Share this post


Link to post
Share on other sites
I'm using managed directx for vb and I want to eventually be able to make a chip-8 emulator with it, so I will probably have to know how to draw pixels to the screen.

Share this post


Link to post
Share on other sites
Couldn't I just make a sprite of size 1x1 and change the color when necessary or would that be stupid?

Share this post


Link to post
Share on other sites
For my emulators, I have a 32-bit texture made to the resolution of the screen and an equally sized 2D array or integers. When the system draws something it sets the array. For each frame I just lock the texture, write the whole array to it and the draw the whole texture across the screen.

Quote:
Original post by u235
1. Define a vertex format
2. Create a vertex and vertex buffer
3. In your render loop, set the vertex buffer appropriately
4. In DrawUserPrimitive(), set the primitive type to D3DPT_POINTLIST


Quote:
Original post by ed209
Couldn't I just make a sprite of size 1x1 and change the color when necessary or would that be stupid?


Both of these would be so slow, you'd fall asleep at the keyboard.

Share this post


Link to post
Share on other sites
I'm unsure of how to write to a texture in Dx, let alone managed Dx. Could someone please show me?

Share this post


Link to post
Share on other sites
Why use DirectX for something so simple? A DIB and BitBlt would more than suffice for what you are doing. Just make sure it's double-buffered to avoid flicker. You won't be able to sync to the vertical retrace, so you may get some shear, but I don't imagine that having any great effect on the type of display you're going to have.

Share this post


Link to post
Share on other sites
I'd go GDI+ only if you're going to keep it in windowed mode. If you want to be able to switch between fullscreen and windowed then I'd use DirectX.

In either situation the high performance method is to create a bitmap/texture, lock/unlock it once per frame, and write pixels to it as if it were an integer array using pointer access (not sure what VB supports as far as that goes but C++ and C# will let you do extremely high speed access in this manner).

Share this post


Link to post
Share on other sites
Quote:
Original post by ravyne2001
Why use DirectX for something so simple? A DIB and BitBlt would more than suffice for what you are doing. Just make sure it's double-buffered to avoid flicker. You won't be able to sync to the vertical retrace, so you may get some shear, but I don't imagine that having any great effect on the type of display you're going to have.


Yea, bitblt would have way too much tear.

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!