How Do I Place One Pixel in D3D8?

Started by
8 comments, last by Chrono999 22 years, 9 months ago
Does anybody know how to do this? All I can think of is taking the backbuffer, but then what? Oh yeah, I know that the question I''m asking may look bad, but I''m not a total newbie, so lay down whatever answers you guys have. Thanks a lot!
Advertisement
look at the 2D article on this site to see how to set things up, then, instead of rendering a textured quad, render points.

do not lock the backbuffer - it''s very slow.

Why are you plotting 1 pixel?

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Well, I''m not just plotting one pixel. I want to plot a series of pixels to render curves like NURBS. I want to experiment with them
Oh yeah, as for your answer, that is genius, why didn''t I think of that
it may be better to plot (very short) lines. If you plot a line strip, there will be less chance of broken curves.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Could you use a tesselation technique to approximate the NURB?

Magmai Kai Holmlor
- Not For Rent
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I''m having success with rendering one point from a vertex buffer for each pixel I want. Unfortunately, in order to have a quality solidness, I''m proccessing 2000 points per curve. I think that the line idea is a good one, but I''m not sure how to go about doing this. If I use the Draw Primitive function and choose to use a linelist, I would have to lock a vertex buffer for every segment of the curve. Or I could write my own line-drawing function that would place pixels the same way as the curve places pixels.

So I guess my next question is how do I plot a line using pixel locations in D3D?
No no no....

Just fill the VB with the points like you would for rendering several points, but render line strips instead. One lock per bunch o'' points...
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
I haven''t been locking my VB to render each point so far, I just have a VB with one vertex in it, my PutPixel() function transforms it and renders it for each pixel
If I''m understanding correctly...

1. Do the math to approximate your curve - generate a bunch of points.

2. place all those points in one vertex buffer

3. render that VB as a line strip for every frame that you want that curve to show up

Rendering things as one big reused VB is MUCH more efficient than refilling the buffer each frame, which is MUCH more efficient than rendering one pixel/line per call to draw primitive. As a general rule - try to draw as many things as you can on each call to DrawPrimitive and lock/unlock as rarely as you can.

Please explain if I''m misunderstanding something.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials

This topic is closed to new replies.

Advertisement