Sign in to follow this  
TaxCollector

drawing pixels

Recommended Posts

I'm making an isometric tile game. To draw my tiles and sprites I use Direct3D. But now I want to make a minimap, and for that I will have to draw pixels. (for every tile on the map, there will correspond 2 pixels on my minimap and depending on what's on the tile, the pixel color will be different) The problem is I haven't found any direct3D function to draw simple pixels. Everywhere I search the internet, people are drawing pixels using directdraw. I was wondering if I should implement directdraw into my code together with Direct3D? Or make a texture consisting of colors and use rectangles to select a color from that texture?

Share this post


Link to post
Share on other sites
I'm not actually sure what the usual way to do this is, but here's how I'd do it...

First, if you have 2 pixels on the minimap to represent one tile, just use one pixel instead, and then stretch it to twice it's normal size. That way, if your minimap was going to be 64x64, you'd just make a 32x32 texture and apply that to a 64x64 quad. make sure you use point filtering to get a blocky effect.

As for the map itself, I'd create a dynamic texture with 1 mip level, and then Lock() it each frame and write the data into it. Calling Lock() (Or it may be LockRect(), I don't recall offhand) on a texture will give you a pointer to the pixels on that texture, and you can then write directly into it, unlock the texture, and then render with it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this