Drawing pixels in D3D ?

Started by
4 comments, last by bilsa 20 years, 8 months ago
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!
Advertisement
why not use a plane with alot of vertices??



Hans-Petter
Hans-Petter Harveg
Billboards or (textured quads facing the camera) is what is normally used, right?
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.
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
Yup, I have already started on that dynamical texture idea. Thx for the posts!

This topic is closed to new replies.

Advertisement