Skip to main content
gamedev.net
🔒 Locked

Plotting pixels on textures

Started by Cluq Oct 10, 2006 at 7:08 AM 1 replies 550+ views
Original Post
Cluq
Cluq
I am creating a 2d game. I want to have some kind of dynamic background (dynamic in the sense that I am drawing each pixel on the background - not just loading an image). How is that done best using DirectX9? I thought of somehow plotting the pixels to a texture and then use LPD3DXSPRITE to draw it on the screen. Is this the best way to do it, and how exactly do you draw pixels in a texture? (and how do you even read a single pixel from a texture, if that is what you need?) Hope that you guys will take the time to help me :) Best regards, Cluq
Jaymar
Jaymar
I don't have time to write a how-to, but if you look into IDirect3DTexture9::LockRect it will probably tell you what you need to know :)
Cluq
Cluq
That's ok - thanks for the hint! I think I understand it a bit more now.

But which of the following approaches to draw 2d do you propose to use:

- use LPD3DXSPRITE to draw textures on the screen (controlling which textures are drawn before other textures by manually handling a render queue)?
- or to use "normal" Direct3D, keeping the Z buffer and let DirectX use the Z buffer to handle which textures are drawn on top of other textures?

Best regards,
Cluq

Topic Locked

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

Sign in to reply to this topic.