Jump to content
  • Advertisement

Archived

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

Chrono999

How Do I Place One Pixel in D3D8?

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

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!

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!