Jump to content
  • Advertisement
Sign in to follow this  
BigBeginner

Pixels drawing are slooooooow

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

I inited and used an pixel-buffer to drawing pixels. Init: ----- MyPixelFormat = record X,Y,Z, RHW : single; Color : cardinal; Device.CreateVertexBuffer (SizeOf(MyPixelFormat), D3DUSAGE_WRITEONLY, D3DFVF_XYZRHW or D3DFVF_DIFFUSE, D3DPOOL_MANAGED, PIXEL); Using: ------ PIXEL.Lock (0, 0, P, 0); PX.X:= X; PX.Y:= Y; PX.RHW:= 1; PX.Color:= D3DCOLOR_ARGB(A, R,G,B); Move (PX, P^, SizeOf(PX)); PIXEL.Unlock; Device.BeginScene; R:= Device.SetVertexShader (D3DFVF_XYZRHW or D3DFVF_DIFFUSE); R:= Device.SetStreamSource (0, PIXEL, sizeof(MyPixelFormat)); R:= Device.DrawPrimitive (D3DPT_POINTLIST, 0, 1); Device.EndScene; So, about 50 pixels drawing its slooooow. I think the lock method affect the slowing. I remember, when using 256 color mode on 486, the pixel drawing were MUCH faster, even 300 pixels... Today the pixeldrawing are slow at 1,1 GHZ celeron computer. Hm :( Or are there faster method?

Share this post


Link to post
Share on other sites
Advertisement
Make the vertex buffer big enough to hold all the points. Then do this once per frame: lock, set the values, unlock, draw. That should be much faster.

Share this post


Link to post
Share on other sites
It might be the way your declaring the vertex buffer and updating it. If you update it each frame, you might want to change the D3DUSAGE_WRITEONLY to D3DUSAGE_DYNAMIC. Also for your fourth parameter on PIXEL.lock, change to D3DLOCK_DISCARD and D3DLOCK_NOOVERWRITE. Hope that helps speed up your process.

Also, like John said, you should try to keep all the pixels in one Vertex Buffer

Share this post


Link to post
Share on other sites
Holy CRAP! Yeah, that's not gonna play. Draw your pixels to a locked texture buffer, then after you're all done, render that texture buffer to the screen.

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!