Archived

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

bilsa

Drawing pixels in D3D ?

Recommended Posts

bilsa    157
Hello! I was wondering how to draw a single pixel in D3D ? If anyone could give me any good site with some info on this I would appreciate it! (I want to make some Water Effects, which I have thought making with pixels...) Thank you!

Share this post


Link to post
Share on other sites
glassJAw    128
While it''s probably not a good idea to use this for water effects, DrawPrimitive() has a D3DPT_POINTLIST type you can use to plot pixels.

Share this post


Link to post
Share on other sites
RapidStunna    122
1. Lock/Unlock the back buffer. This method is often not preferred because it limits the capabilities of your hardware. If you''re changing a buffer that''s supposed to be located in hardware memory with software operations, you''re not going to be getting best performance. If you insist on using it however, make sure you set D3DPRESENTFLAG_LOCKABLE_BACKBUFFER as a flag in your present parameters structure.

2. A beter method would be to update a dynamic texture and render it using textured quads. The quads could either be viewport-aligned or pre-transformed. If your dealing with purely 2D operations, pre-transformed quads would work fine. Look into the RHW parameter for flexible vertex formats.

3. Also, don''t forget that you can sent a point or triangle list. You''re obviously going to need to stream your points in batches because :

you shouldn''t be using the same vertex buffer for every point with a different translation matrix

AND

a single vertex buffer probobly won''t store the total amount of vertices to be rendered anyway

AND

to get optomal performance, you should batch your rendered objects.


Performance between the second and third methods shouldn''t be too bad. It''s the first one that you should try to avoid.

---
Brent Gunning | My Site

Share this post


Link to post
Share on other sites