SharimaI need to know how to plot a pixel the best way with directdraw7. Should I use getlockedpixel, setlockedpixel? I have no idea how to use them. Now I only bltcolorfill my pixels, but colors end up different at different tasks (even though I use the same long-number) Any tips on how to go? Thanks.
PeterThis might help: http://voodoovb.talosstudios.com/setlockedpixel.html There is a faster way, GetLockedArray. I think at one point I was going to write a tutorial about it, but then I lost interest in pixel-plotting. Hth
SharimaYep! That helped out alot! But the colors are still messed up. Can't believe it! Let's say my HUD.HUDCOLOR = 128 (rgb(128,0,0)). The hud is drawing in the correct color, dark red. But I do use the same value for creating the guidemap for my map (when map is loaded), the colors becomes darkdark green. It's wierd. Here's an example, contrast boosted: (the green is almost invisible against black bg) [img]http://w1.911.telia.com/~u91117762/crap.gif[/img]
PeterAre you using a 16-bit colour-depth? I think that example only works for 32-bit and 24-bit. The problem with 16-bit colour mode is you would have to convert your rgb values into their 16 bit equivalents. It becomes a little more complicated since depending on the card, the colours can be represented in either a 5-5-5 or 5-6-5 mode (ie: 5 bits for red, 5 bits for green, 5 bits for blue). So basically on some cards you have more of a 15-bit mode.
SharimaIt doesn't matter which color depth I'm using. I've tried 16, 24, 32.. The colors turn out the same every way. I've read that dx can use vb's rgb in bgr order. That seams pretty like it. When I used rgb(0,0,255) as hudcolor, the guidemap using that color when plotting turned out red. So that's reversed order. But the rest of the hud, is then blue. Why is ddraw just "flipping" the values sometimes? It's the same at my starfield, moving in the background. All .drawtext and .drawbox uses the right color, but .bltcolorfill and setlockedpixel uses the reversed order. I can't get it. Any ideas?
Eric ColemanI think it depends on the pixel format of the surface. There is a post here on this message board where someone asked about this same problem, and also search the message board at http://www.mwgames.com/voodoovb/ for the answer, because it has been discussed there many times.
SharimaThanks. I'm going to look into it more, though I solved it by use 32/24 bpp, and saving the integer rgb values separatly. Then just swap order when needed. This only seams to work 16+ bpp..
dxgamePixel plotting is very slow under Direct X 7. For a Hud setup you may want to experiment with using "pixel sprites" (1x1 areas) and just blit them on to the screen using the bltfast method. On several graphics cards we tested this compared to locking the screen, blitting the 1 pixel sized sprites was faster than accessing the locked array.
SharimaOh. But I'm only writing the hud guidemap to a simple small surface when loading the map. Then when inside the game, it just blit the guidemap surface onto the screen. Really fast actually. So it doesn't really matter if it's a little slower. :)