|
-
Jun 21st, 2001, 02:37 PM
#1
Thread Starter
Frenzied Member
Palette Animation
I have heard about palette animation a lot and I think I could have use for that. Is there a good place where I can learn how to make a palette animation in Direct Draw (7)
Last edited by /\/\isanThr0p; Jun 21st, 2001 at 02:44 PM.
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 21st, 2001, 03:19 PM
#2
Good Ol' Platypus
Well, for starters, it's really easy to populate 3 byte arrays/long array with the colours shown on the pallette, shown below:
VB Code:
Dim byteRGB() As PALETTEENTRY
Dim pDescriptor As DirectDrawPalette
Dim R(255) As Byte
Dim G(255) As Byte
Dim B(255) As Byte
Dim LNG(255) As Long
Dim It As Integer
Set pDescriptor = [Surface].GetPalette
pDescriptor.GetEntries 0, 256, byteRGB()
For It = 0 To 255
R(It) = byteRGB(It).red
G(It) = byteRGB(It).green
B(It) = byteRGB(It).blue
LNG(It) = RGB(byteRGB(It).red, byteRGB(It).green, byteRGB(It).blue)
Next It
To get the colours that you need for getlockedarray methods, just call on R(), G(), and B(). For other operations (API) use the LNG array.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Jun 21st, 2001, 03:27 PM
#3
Thread Starter
Frenzied Member
thanks
that far it's all clear how can I animate that? I want it to change continiously.
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 21st, 2001, 03:36 PM
#4
Thread Starter
Frenzied Member
Hey
ahm does that only work with 8 bit mode or surface?
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 21st, 2001, 03:42 PM
#5
Good Ol' Platypus
Works only w/8bit surfaces
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Jun 21st, 2001, 04:11 PM
#6
Thread Starter
Frenzied Member
ok
I tried to make the palette of the surface 8 bit by doing that but it still gives me an automation error (DDerr_generic)
sur.ddsd.ddpfPixelFormat.lRGBBitCount = 8
what do I have to do?
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 22nd, 2001, 03:03 AM
#7
Frenzied Member
There's a very good sample that includes direct access to video memory and palette rotation in the DX MSDK, it's called DDBlend.
But you shouldn't create your own palette like that: you'll notice it's much easier to load it from a file so you can modify it as you wish (eg.: you'll notice that Starcraft's palette is very irregular, like it has 6 gradations for metal colors, a few more for dirt ground etc; you should do this instead of making a general palette that may have colors you don't need and not have the colors you need )
You should rotate it like this once you get the palette:
VB Code:
'To rotate the first 8 colors
Dim Temp As Long
Temp = Pal(0)
For i = 0 to 6
Pal(i) = Pal(i + 1)
Next i
Pal(i + 1) = Temp
Ok, to make it work for other colors, you can just replace the 0s with the first color and 7 with the last one. Good luck
-
Jun 22nd, 2001, 03:12 AM
#8
Thread Starter
Frenzied Member
ok thanks for that
but how can I create a 8 bit surface
do I just have to save the file in 8 bit or what?
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 22nd, 2001, 04:37 AM
#9
Thread Starter
Frenzied Member
Ok I played around with the blend example.
I think I cant work it without setting the display mode to 8bit. That is impossible for me though, because I just want to animate the background for a 3d game. I cant set the game to 8 bit only for that.
Thanks anyways. If anyone has a solution please help!
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 22nd, 2001, 05:53 AM
#10
Frenzied Member
That's even easier: just save the image as 8-bits (most graphics programs let you choose your palette), and edit the palette of the surface where you have the image in the game, using the code I gave you.
There's no problem about blting it to a 24-bits surface
-
Jun 22nd, 2001, 06:01 AM
#11
PowerPoster
Yes, DX will do this job for you. Also you can load 24bit surfaces and blt to a 8bit buffer, DX will convert the colors...
meaning: Your buffers dont have to be the same color depth
-
Jun 24th, 2001, 03:16 AM
#12
Thread Starter
Frenzied Member
Well sounds all just great. The only problem is I cant make it. I loaded an 8bit picture (pallete optimal) to a surface without doing anything special. Well when I try to get the palette I get an automation error. I dont know what I have to do. The game is in 16 bit. I cant use anything else because of the crappy graphicsboard I got here.
Sanity is a full time job
Puh das war harter Stoff!
-
Jun 24th, 2001, 06:20 AM
#13
-
Jun 25th, 2001, 03:28 AM
#14
Thread Starter
Frenzied Member
buhuuuuuuu
so what should I do? A static background to my 3d Pong sounds extremely boring to me.
HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Any Ideas that dont take to much memory and CPU power are very welcome.
Sanity is a full time job
Puh das war harter Stoff!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|