Skip to main content
gamedev.net
🔒 Locked

blitting in 2D efficiency

Started by unreason 0 replies 600+ views
Original Post
unreason
unreason
I'm writing some directX8 code to draw 2D sprites to the screen. Basically, I've got a vertex buffer with a quad in it, and by using translation, I draw it in various places, with different textures. Because it's the same quad, I can keep the vertex buffer locked, and gain some efficiency. I have a problem, though, when it comes to the texture. Obviously, the texture uv coordinates need to change so that I can draw different sprites. However, as far as I can tell, the only way I can change the uv coordinates is to lock, change, and unlock the buffer, which means a performance hit. Is there any better way of quickly changing the uv parameters used to draw the quad?
doublepoison
doublepoison
Quote:
Original post by unreason
I'm writing some directX8 code to draw 2D sprites to the screen. Basically, I've got a vertex buffer with a quad in it, and by using translation, I draw it in various places, with different textures. Because it's the same quad, I can keep the vertex buffer locked, and gain some efficiency. I have a problem, though, when it comes to the texture. Obviously, the texture uv coordinates need to change so that I can draw different sprites. However, as far as I can tell, the only way I can change the uv coordinates is to lock, change, and unlock the buffer, which means a performance hit. Is there any better way of quickly changing the uv parameters used to draw the quad?


Just use separte quads, you won't see a great performance loss as its only two verts per quad, and it'll be faster than having a dynamic vert buffer for a single quad (the only alternative).

Also an indexed vert buffer would be faster.

double.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.