Sr. Guapo
Swordmaster
USA
272 Posts |
Posted - May 27 2004 : 5:30:28 PM
|
OK, here goes. In the DaBooda 2D Engine, I have been having constant problems trying to get it to run. Finally I discovered the line of code giving me the error. The line of code is simply the line which renders the sprite(Tri Strip) to the backbuffer:
Direct3DDevice.DrawPrimitiveUP D3DPT_TRIANGLESTRIP, 2, TextureStrip(0), Len(TextureStrip(0))
The exact error is an automation error, if that helps. I know this has happenned to me before when I have tried drawing 2D triangles in DX8, though not for a while. I can't remember how I fixed it, or if I even did. If anyone has experienced this before, please impart on us your knowledge... |
|
masterbooda
Swordmaster
277 Posts |
Posted - May 27 2004 : 5:53:24 PM
|
Thank you for posting this, I forgot to last night...
I have still been looking for an answer to this, without any luck... I hope somebody knows..
DaBooda out...
|
DaBooda Team is back: http://dabooda.789mb.com/ |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - May 27 2004 : 10:31:24 PM
|
quote: The exact error is an automation error,
All errors in DirectX will be an "automation error." You need to make a note of the actuall error number and then use the d3dx (DirectX8) library to find out what the error number means. If you're using DirectX7, then you can get an error lookup tool from VoodooVB.
If you know which line is causing the error, then you can easily look in the SDK to find out what kind of possible errors that sub, function, method, or property could generate. |
|
|
masterbooda
Swordmaster
277 Posts |
Posted - May 28 2004 : 01:15:49 AM
|
I did that already and all the error code states, is that a bad parameter has been passed to the call. Now considering all the parameters there is(are, sorry dumb country boy from oklahoma), I was hoping there would be somebody that had a similar problem and already figured out the parameter, to save some debug time. I was wondering if it could be the specular component, because for all my other programs, I never used it, but now I am...
Sr. Guapo, do me a favor and change all the colors to default values on the strips, and see if it will display it... just do this in the RenderMap sub in the DBTurbo2DEngine.cls, it is the first one called from the render routine... the commands look like this 'Set up Strip TextureStrip(0) = MakeStrip(TopX, TopY, 0, 1, TSMap.C1, TSMap.S1, TMap.Tx1, TMap.Ty1) TextureStrip(1) = MakeStrip(TopX + TMap.SubMapWidth, TopY, 0, 1, TSMap.C2, TSMap.S2, TMap.Tx2, TMap.Ty1) TextureStrip(2) = MakeStrip(TopX, TopY + TMap.SubMapHeight, 0, 1, TSMap.C3, TSMap.S3, TMap.Tx1, TMap.Ty2) TextureStrip(3) = MakeStrip(TopX + TMap.SubMapWidth, TopY + TMap.SubMapHeight, 0, 1, TSMap.C4, TSMap.S4, TMap.Tx2, TMap.Ty2)
Just change the TSMap.C1...C4 to &HFFFFFFFF and the TSMap.S1...S4 to 0... see if that will display the maps....
I hope that works, because that is an easy fix... maybe...
Thanks for the help...
DaBooda out... |
DaBooda Team is back: http://dabooda.789mb.com/ |
|
|
Almar
Moderator
Netherlands
192 Posts |
Posted - May 28 2004 : 02:35:07 AM
|
Just as a quick General tip:
Len(TextureStrip(0))
you know before what type Texturestrip is, so simply make it a constant. I doubt VB's compiler will calculate how big Len(TextureStrip(0) is during compilation. So, if you make a constant of it, you'll save a needless call, X times, every frame.. :) |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - May 28 2004 : 08:45:41 AM
|
Did you set the correct FVF? And instead of using "2" in the function, use "2&" to avoid an implicit conversion everytime the function is called. |
|
|
masterbooda
Swordmaster
277 Posts |
Posted - May 28 2004 : 09:32:35 AM
|
One issue of this error, is that it works perfectly well on my computer, as it does others, but there are a few that it does not work on. If the FVF was set up wrong, wouldn't it not work at all? And for the 2&, I am clueless as to what you are trying to say there, so could you clarify that a little bit more for me? Thank you so far...
DaBooda out...
|
DaBooda Team is back: http://dabooda.789mb.com/ |
|
|
Sr. Guapo
Swordmaster
USA
272 Posts |
Posted - May 28 2004 : 11:50:50 AM
|
Sorry to say it, but changing the colors did not help... Also, does DX have its own set of errors I can display (or at least output w/ debug.print)? If so, how do I access these. All I can get now is the vague VB Automation Error and some weird number: -2005530516 (8876086c)... |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - May 28 2004 : 12:58:21 PM
|
As I said already, use the d3dx library to lookup the error number. Check directx4vb, it's used in some of the examples.
Also, "2&" is an explicit constant of type long, compared to "2" which is an implicit constant of type integer. |
|
|
masterbooda
Swordmaster
277 Posts |
Posted - May 28 2004 : 3:43:08 PM
|
Sorry about that, I was just awake and blurry eyed, when I read your post, I didn't know you were talking about the drawprimitiveup function, I would try that, but the error is not on my end... I woder if Sr. Guapo had any luck changine that... because that might fix it, but I'm at this moment, not holding much hope...
Sorry again, I didn't see the 2... need coffee before getting on these things...
Also to Almar, thanks for the head up on that, that will save a some process time, which in video game terms equal fps... but if the value within TextureStrip(0 to 3) is always changine, would that effect the size of it... or am I looking at this wrong... I know, I will try it out... couldn't hurt...
DaBooda Out.... and thanks again for the help...
To self: should have made the engine in dx7.... |
DaBooda Team is back: http://dabooda.789mb.com/ |
|
|
Sr. Guapo
Swordmaster
USA
272 Posts |
Posted - May 28 2004 : 5:27:26 PM
|
quote: if the value within TextureStrip(0 to 3) is always changine, would that effect the size of it
No, it is just the size on disk. If you change the value of a variable, it doesn't change the size of the variable.
About the 2&, I did change it, but nothing happened. I don't know. I wil keep trying... |
|
|
VBBR
Moderator
Brazil
617 Posts |
Posted - May 28 2004 : 6:31:33 PM
|
See, just from the top of my head... You are creating 2 triangles, right? So this is 4 vertices. So,
Len(TextureStrip(0))
shouldn't be
Len(TextureStrip(0)) * 4
? Maybe this problem only occurs on Sr. Guapo's PC because most cards could figure out the correct size and manage that, but maybe his doesn't. |
Whatever. Who knows... |
|
|
masterbooda
Swordmaster
277 Posts |
Posted - May 28 2004 : 7:09:30 PM
|
The problem I am having, is the Len(TextureStip(0))
Isn't that calculation done on vb's end before it is passed over to the DirectX8 call... for example I have this function..
Value = Multiply(4*2, 8)
It will return a 64 of course, now vb will covert this 4*2 to be considered an 8 before being passed to the function itself, so the function is only recieving two 8's, or am I seeing this wrong....
For example lets say that Len(TextureStrip(0)) is equal to 4. I create this constant TSize = 4 These commands then are identical:
Direct3DDevice.DrawPrimitiveUP D3DPT_TRIANGLESTRIP, 2, TextureStrip(0), Len(TextureStrip(0)) Direct3DDevice.DrawPrimitiveUP D3DPT_TRIANGLESTRIP, 2, TextureStrip(0), TSize Direct3DDevice.DrawPrimitiveUP D3DPT_TRIANGLESTRIP, 2, TextureStrip(0), 4
Because the call gets the same values regardless right?
DaBooda out... |
DaBooda Team is back: http://dabooda.789mb.com/ |
|
|
VBBR
Moderator
Brazil
617 Posts |
Posted - May 28 2004 : 7:12:34 PM
|
What I meant was, one Len(TextureStrip(0)) for one vertex, four times Len(TextureStrip(0)) for vertices. |
Whatever. Who knows... |
|
|
masterbooda
Swordmaster
277 Posts |
Posted - May 28 2004 : 7:22:51 PM
|
Yes but when you use the Len() statement, you are actually gathering the size of the full array, so if you multiply it by 4, you will get 4 times what you would need... right?
Sometimes, I am stubborn about wrapping my head around code... forgive me on this... I am trying to figure out a way to error proof this ahead of myself... Must find the error first....
DaBooda out... |
DaBooda Team is back: http://dabooda.789mb.com/ |
|
|
VBBR
Moderator
Brazil
617 Posts |
Posted - May 28 2004 : 7:26:00 PM
|
I guess array(0) returns the variable of index 0 right? so Len(array(0)) returns the size of the variable in index 0.
Also I think Jack Hoxley's tutorials do multiply the values. |
Whatever. Who knows... |
|
|
|
|