|
-
Mar 9th, 2002, 06:34 PM
#1
Thread Starter
Good Ol' Platypus
Has anyone ever gotten Surface.GetPalette to work?
I've tried EVERYTHING, and nothing works. This is the code that's loading a 256-colour bitmap, in a 256-colour 640x480 fullscreen window:
VB Code:
'Set Logo surfaces.
dLogo.lFlags = DDSD_HEIGHT Or DDSD_WIDTH Or DDSD_CAPS
dLogo.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
dLogo.ddpfPixelFormat.lFlags = DDPF_PALETTEINDEXED8
dLogo.lWidth = 640
dLogo.lHeight = 480
Set Logo = DD7.CreateSurfaceFromFile(App.Path & _
"\resource\logo.bmp", dLogo)
'Get Palette
Set SavePalette = Logo.GetPalette
SavePalette.GetEntries 0, 256, SavePalEntries()
And it always gives me "Automation Error | Unspecified Error" highlighting the GetPalette method.
Help...?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 9th, 2002, 06:35 PM
#2
Thread Starter
Good Ol' Platypus
Okay, an update.
I added "Or DDSD_PIXELFORMAT" to the .lFlags parameter and now it's bombing out on the CreateSurfaceFromFile method, with "Automation Error".
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 11th, 2002, 10:53 AM
#3
I guess there is no need in VB to zero out unused fields or set the size of structures, right?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 11th, 2002, 11:55 AM
#4
Thread Starter
Good Ol' Platypus
Really... Please explain, I have the feeling you will be able to solve my problem
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 11th, 2002, 01:27 PM
#5
In C++, when I use any struct like DDSURFACEDESC2, I first have to do two things:
Code:
DDSURFACEDESC2 ddsd;
ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(DDSURFACEDESC2);
The first line is like
Dim ddsd as DDSURFACEDESC2
The second fills the complete struct with 0.
The third sets the dwSize member (that's lSize in VB) to the length of the struct ( Len(DDSURFACEDESC2) ).
Then I can set the members I need. If I don't do that, nothing will work.
Now I suspect, since all DX calls are wrapped in VB, that you don't have to do that. Am I right?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 11th, 2002, 03:11 PM
#6
Thread Starter
Good Ol' Platypus
Yeah, I haven't had to do that.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 11th, 2002, 04:40 PM
#7
Junior Member
I think you might need to create your palette before you can "get" it...
from my palettes tutorial:
Set DDPalette = dd.CreatePalette(DDPCAPS_8BIT Or DDPCAPS_ALLOW256, Pal())
- sure you're not ACTUALLY wanting to create the palette (fill it with the data from Pal() ), but i dont remember how DD operates internally... and I'm guessing that once you created it the GetPalette() call will just overwrite the data for you...
Secondly, work out what the automation error is telling you - it may give you the hint that you need 
Jack;
-
Mar 11th, 2002, 04:44 PM
#8
Thread Starter
Good Ol' Platypus
I'll try that.
This is, by the way, trying to do the same thing I had emailed you about last year.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 11th, 2002, 04:49 PM
#9
Junior Member
aah, oops
i dont really remember the questions that people email me about...
Jack;
-
Mar 11th, 2002, 04:52 PM
#10
Thread Starter
Good Ol' Platypus
Thank you both for your advice, however it still gives me an Unspecified Automation Error whenever I run the code.
This really bites 
Anyone have any source code of the GetPalette method in action?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 11th, 2002, 04:57 PM
#11
Junior Member
what do you mean by "Unspecified Automation Error"? you mean that you've dereferenced it to a DDERR_?? value + description, OR you're just leaving it as an automation error?
Jack;
-
Mar 11th, 2002, 05:50 PM
#12
Thread Starter
Good Ol' Platypus
Do you use the GetLastError thingey to get the error or something? I remember in DirectGraphics finding the error but I don't know about DirectDraw.
God it's hard to type on this computer...
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 11th, 2002, 06:43 PM
#13
Junior Member
you basically need to parse through the whole list of errors, D3DX8 makes things easy - but DD7 was quite hard 
Check out this class module i 'wrote' - it'll output the description and error value.
post that back here and I/someone can maybe help you out... or it may be obvious to you straight away...
Jack;
-
Mar 12th, 2002, 03:02 AM
#14
Addicted Member
I don't know if this will really help but I think I've noticed a little error in you're code, maybe.
SavePalette.GetEntries 0, 256, SavePalEntries()
The part saying "0, 256," is that supposed to mean get palette entries 0 through 256? If so that might be your problem. If you count starting with 0 then it would be 255 instead of 256.
I don't know if this'll help, but hey, it's worth a try. 
Drewski
-
Mar 12th, 2002, 10:04 AM
#15
I think it is a count, not an end point. You can still try.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 12th, 2002, 10:28 AM
#16
Thread Starter
Good Ol' Platypus
Nope, thanks anyway, but the program stops before that line and it is indeed the count.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|