| Compiling SPARK2 and DX9 causes bunch of errors | |
|
|
Author | Message |
---|
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: Compiling SPARK2 and DX9 causes bunch of errors Wed Mar 23, 2011 5:07 pm | |
| Hi i tried to build SPARK2 yesterday. The Irrlicht , OGL , and the SFML module builds fine but the DX9 causes bunch of errors .I got approximately 300 errors like these : - Code:
-
..\..\..\src\Rendering\DX9\SPK_DX9_Renderer.cpp(29) : error C2653: 'DX9Renderer' : is not a class or namespace name ..\..\..\src\Rendering\DX9\SPK_DX9_Renderer.cpp(29) : error C2065: 'BlendMode' : undeclared identifier ..\..\..\src\Rendering\DX9\SPK_DX9_Renderer.cpp(29) : error C2146: syntax error : missing ')' before identifier 'blendMode' ..\..\..\src\Rendering\DX9\SPK_DX9_Renderer.cpp(29) : error C2182: 'setBlendMode' : illegal use of type 'void' ..\..\..\src\Rendering\DX9\SPK_DX9_Renderer.cpp(29) : error C2059: syntax error : ')' ..\..\..\src\Rendering\DX9\SPK_DX9_Renderer.cpp(30) : error C2143: syntax error : missing ';' before '{' ..\..\..\src\Rendering\DX9\SPK_DX9_Renderer.cpp(30) : error C2447: '{' : missing function header (old-style formal list?) It seems like there's missing some header files... Any suggestions? Thanks in advance ! | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Fri Mar 25, 2011 11:59 am | |
| Yes the directX module is not compiling atm. There should not be a lot of things to get it compile. I ll take a look when I have time to make it work. Sorry about that. | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: Works fine Mon Apr 04, 2011 4:26 am | |
| Hi SPARK2 now works fine , but it seems that SPARK2 is completely different from SPARK1 , i looked into the html documentation and i understand it quite well. But i cant figure out how to delete a specific System , zone , renderer (since the SPK_Destroy() is not included in SPARK2 ) ? Can you help me about this ? However i really liked the new interpolation system , setting parameters directly instead of creating Models
Really good job ! Thanks a lot Regards | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Mon Apr 04, 2011 6:13 am | |
| Hi, everything now works automatically : Instead of handling pointers to spark objects, you handle reference to spark objects : SPK::Ref<...>. Those references are smart pointers which delete underlying object automatically when the last reference pointing to it is deleted. This system allows the user not to take care about life time of object. It guarantees no memory leaks and no invalid pointers and is very simple to use. | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: Hi Wed Apr 06, 2011 11:47 am | |
| Hm... sounds cool , but i can't understand this "automatic object deletion"
Lets say theres a Group with 4 emitters , when i remove one of these emitters (group->removeEmitter(EmitterID) ) and if this removed emitter has no more connection with any other object , it is automcatically deleted ?
Or what happens if a System becomes inactive (no more active particles) like explosions , are they automatically deleted too ?
Sorry for bothering... maybe i just need to wait for the first official release of SPARK2 to understand it better...
Regards | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Wed Apr 06, 2011 12:05 pm | |
| Basically, as soon as there s a Ref on an Spark object somewhere, the object will not be deleted. Spark objects keep ref of their underlying objects. Regarding your example there is an array of Ref<Emitter> in a group. If you remove an emitter that way : - Code:
-
group->removeEmitter(group->getEmitter(0)); The first emitter of the group will be removed, and its reference in the group is deleted, if there is no more references elsewhere, the emitter is deleted avoiding a memory leak. Now say you do something like that : - Code:
-
Ref<Emitter> emitterRef;
...
{ emitterRef = group->getEmitter(0); group->removeEmitter(emitterRef); }
There the emitter will be removed from the group but not deleted as emitterRef keeps a reference on this emitter. If you know smart pointers, SPK::Ref<T> are intrusive smart pointers. If you know java or C# (managed languages), SPK::Ref<T> works a bit like references in those language (except there are deleted right away and not after a garbage collector run) So what it means is that you dont have to worry about deletion of memory with this system, if an object becomes unreachable it is deleted (instead of causing a memory leak). If a system becomes inactive, nothing is deleted, but if a system is deleted, all the inner objects only referenced by the system are deleted as well. Hope this is clearer. | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: Got it Wed Apr 06, 2011 12:39 pm | |
| Yes now are much more clearer . Thanks a lot ! | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: another question Fri Apr 15, 2011 3:11 pm | |
| Hi ! I wrote some basic test programs using spark2 and it seems it works fine , but i have encountered a small problem. Refs and Lists ? I mean , when a fuction ends all local variables (and Refs) are deleted , but i want to render a list<System*> of Systems (like in the explosion demo) . How can i store References in a list? or is this actually possible ? I tried - Code:
-
list<Ref<System>> all_systems;
//then creating a system
void CreateNewParticles() { Ref<System> newSystem = System::create(true);
//then adding this new system to the list all_systems.push_back(newSystem);
//etc...
}
But it wont work. newly created systems are deleted right after the CreateNewParticles() function ends. Any suggestions ? Thanks | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Fri Apr 15, 2011 4:41 pm | |
| Are you sure ? This is supposed to work well. What compiler are you using ? If you add this line to your code right after the push_back to the list - Code:
-
cout << newSystem->getNbReferences() << endl
What number do you get ? You should get 2 (one reference for the newSystem in the scope and the other for the reference in the list) I tried your code, and it worked with visual studio 2008. | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: solved Fri Apr 15, 2011 5:05 pm | |
| Oh you are right... It was a mistake !Sorry... i forgot to mention in my previous post that my function returns a Ref<> to SPKObject - Code:
-
Ref<System> createMyParticles() { Ref<System> newSystem = System::create(true); all_systems.push_back(newSystem); return newSystem; } now i changed Ref to a pointer - Code:
-
System* createMyParticles() { Ref<System> newSystem = System::create(true); all_systems.push_back(newSystem); return newSystem.get(); } and yep ! it works fine ! Thanks | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Fri Apr 15, 2011 5:10 pm | |
| mmm... strange. It is supposed to work anyway. Normally you should never use a standard pointer (ie use Ref<>::get()) Are you sure you werent returning a Ref<System>& instead of a Ref<System> ? | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: post Fri Apr 15, 2011 5:46 pm | |
| Yes i tried with &... im creating a wrapper for non OOP languages so i need a pointer to specific objects when i tried with - Code:
-
Ref<System> newSystem::create(); return &newSystem; //or simply return newSystem ; after calling my system creation function lets say 5 times it returns always the same mem adress again and again (assuming that the function always allocates the same memory address because when the function ends , the newSystem is deleted because its local EVEN when i add it to my global system-list) but now works with get() i completely finished a wrapper with SPARK 1.05.04 , but there was a huge memory leak ( DX9 Renderer) i cant find a solution for that so i decided to use SPARK2 and it seems it works fine , (but i didnt test it entirely i still afraid of DX9 renderers ) Anyway Thanks for you help ! Much much appreciated ! | |
|
| |
stardeath Committer
Messages : 140 Date d'inscription : 2009-08-24
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Sun Apr 17, 2011 4:09 am | |
| did you trace the memory leak?
is it a COM leak (some dx9 components not released) or a standard c++ leak? | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: hi Fri Apr 22, 2011 6:20 am | |
| Hi ! Well i didnt trace the memory leak but how i remember it was a COM leak (Not shure though , i need to find the project because i started a new one with SPARK2 months ago ) Now everything works fine , i got it working in other non OOP languages with the DX9 module but i found out that , when : - Code:
-
PARAM_TEXTURE_INDEX
is used the program crashes . Works fine when - Code:
-
PARAM_SCALE PARAM_MASS PARAM_ANGLE PARAM_ROTATION_SPEED
used Also theres a problem with the saveDX9States() i got an LNK2001: unresolved external symbol error when linking. Im sure these are not bugs but some missing features , most important thing is finally theres no mem leak problem at all Thanks for everything ! Regards ! | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: Hi Sat Apr 23, 2011 6:42 am | |
| Hi Juff ! Can you please tell me which features missing currently from SPARK2 ? - Code:
-
//This crashes the program when DX9QuadRenderer is used for this group
newGroup->setParamInterpolator(SPK::PARAM_TEXTURE_INDEX , SPK::FloatRandomInitializer::create(0.0f,4.0f));
//and theres a problem with the Transform too . when i reposition a system it disappears...
newSystem->getTransform().setPosition(Vector3D(px,py,pz)); newSystem->updateTransform(); So what do you suggest ? Continue using SPARK1 or wait for SPARK2 to become more stable ? Thanks | |
|
| |
stardeath Committer
Messages : 140 Date d'inscription : 2009-08-24
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Sat Apr 23, 2011 11:22 am | |
| thanks for the report, i'am currently looking at your problems.
ps: PARAM_TEXTURE_INDEX seems working now, i haven't fully test it yet | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: Hi Sun Apr 24, 2011 5:09 am | |
| Hi ! Thanks for the response ! Now the program not crashing but PARAM_TEXTURE_INDEX has no effect on atlas dimensions (does nothing) and theres a rendering issue when PARAM_TEXTURE_INDEX is NOT enabled on a group Heres a small video showing the rendering issue https://www.youtube.com/watch?v=-RuOHVJ_GBEThanks ! | |
|
| |
stardeath Committer
Messages : 140 Date d'inscription : 2009-08-24
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Mon Apr 25, 2011 5:53 am | |
| i'am looking at it.
ps: should be better now. | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: Yesss Mon Apr 25, 2011 10:13 am | |
| Works perfectly ! Thank you stardeath very very much ! Regards ! EDIT: The report about the transform in my previous post... The transform works as it should, it was a stupid - inconspicuous bug in my code ... | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Tue Apr 26, 2011 3:53 am | |
| Ok so everything works fine by now ? | |
|
| |
Charlie
Messages : 81 Date d'inscription : 2011-01-28 Age : 42
| Subject: Yes Tue Apr 26, 2011 4:13 am | |
| Yes . I tested almost everything and worked as it should.Zones , Emitters , Groups , Systems , Inerpolators (ColorGraph , color , random interpolator , random initializer), Renderers (Only tested the quad renderer) works fine. Saving is working , only the renderer serialization i missing but this is really optional for me for now .
So thank you for everything ! You guys did a really great job ! Keep up the good work Best Regards | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors Tue Apr 26, 2011 5:00 am | |
| Yes the renderer serialization is not yet implemented. I m working on refactoring the renderers but as I dont have much time for spark now, the progress is rather slow. | |
|
| |
Sponsored content
| Subject: Re: Compiling SPARK2 and DX9 causes bunch of errors | |
| |
|
| |
| Compiling SPARK2 and DX9 causes bunch of errors | |
|