Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Pixelplotting?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Sharima
Squire

Sweden
10 Posts

Posted - Feb 15 2004 :  7:56:06 PM  Show Profile  Visit Sharima's Homepage  Send Sharima an ICQ Message  Click to see Sharima's MSN Messenger address  Reply with Quote
I 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.

Lead Programmer @ EB3K Project
- www.theframeworkproject.tk

Peter
Administrator

Canada
67 Posts

Posted - Feb 16 2004 :  08:13:28 AM  Show Profile  Visit Peter's Homepage  Reply with Quote
This 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


Talos Studios - VoodooVB - VB Gamer

Go to Top of Page

Sharima
Squire

Sweden
10 Posts

Posted - Feb 16 2004 :  09:39:17 AM  Show Profile  Visit Sharima's Homepage  Send Sharima an ICQ Message  Click to see Sharima's MSN Messenger address  Reply with Quote
Yep! 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)


Lead Programmer @ EB3K Project
- www.theframeworkproject.tk
Go to Top of Page

Peter
Administrator

Canada
67 Posts

Posted - Feb 17 2004 :  07:54:37 AM  Show Profile  Visit Peter's Homepage  Reply with Quote
Are 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.


Talos Studios - VoodooVB - VB Gamer

Go to Top of Page

Sharima
Squire

Sweden
10 Posts

Posted - Feb 17 2004 :  11:01:21 AM  Show Profile  Visit Sharima's Homepage  Send Sharima an ICQ Message  Click to see Sharima's MSN Messenger address  Reply with Quote
It 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?

Lead Programmer @ EB3K Project
- www.theframeworkproject.tk
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Feb 17 2004 :  1:53:07 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
I 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.
Go to Top of Page

Sharima
Squire

Sweden
10 Posts

Posted - Feb 17 2004 :  4:38:08 PM  Show Profile  Visit Sharima's Homepage  Send Sharima an ICQ Message  Click to see Sharima's MSN Messenger address  Reply with Quote
Thanks. 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..


Lead Programmer @ EB3K Project
- www.theframeworkproject.tk
Go to Top of Page

dxgame
Knave

USA
73 Posts

Posted - Feb 20 2004 :  02:52:30 AM  Show Profile  Visit dxgame's Homepage  Reply with Quote
Pixel 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.
Go to Top of Page

Sharima
Squire

Sweden
10 Posts

Posted - Feb 22 2004 :  2:08:45 PM  Show Profile  Visit Sharima's Homepage  Send Sharima an ICQ Message  Click to see Sharima's MSN Messenger address  Reply with Quote
Oh. 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. :)

Lead Programmer @ EB3K Project
- www.theframeworkproject.tk
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.12 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.