Post

 Resources 

Console

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

 All Forums
 VBGamer
 VBGamer
 DrawPrimitiveUP error
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 12

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - May 27 2004 :  5:30:28 PM  Show Profile  Reply with Quote
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  Show Profile  Visit masterbooda's Homepage  Reply with Quote
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/
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 27 2004 :  10:31:24 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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.
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - May 28 2004 :  01:15:49 AM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
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/
Go to Top of Page

Almar
Moderator

Netherlands
192 Posts

Posted - May 28 2004 :  02:35:07 AM  Show Profile  Visit Almar's Homepage  Send Almar an ICQ Message  Reply with Quote
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.. :)
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 28 2004 :  08:45:41 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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.
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - May 28 2004 :  09:32:35 AM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
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/
Go to Top of Page

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - May 28 2004 :  11:50:50 AM  Show Profile  Reply with Quote
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)...
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - May 28 2004 :  12:58:21 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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.
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - May 28 2004 :  3:43:08 PM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
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/
Go to Top of Page

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - May 28 2004 :  5:27:26 PM  Show Profile  Reply with Quote
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...
Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - May 28 2004 :  6:31:33 PM  Show Profile  Reply with Quote
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...
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - May 28 2004 :  7:09:30 PM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
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/
Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - May 28 2004 :  7:12:34 PM  Show Profile  Reply with Quote
What I meant was, one Len(TextureStrip(0)) for one vertex, four times Len(TextureStrip(0)) for vertices.

Whatever. Who knows...
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - May 28 2004 :  7:22:51 PM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
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/
Go to Top of Page

VBBR
Moderator

Brazil
617 Posts

Posted - May 28 2004 :  7:26:00 PM  Show Profile  Reply with Quote
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...
Go to Top of Page
Page: of 12 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.17 seconds. Snitz Forums 2000

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