Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Help with SPARK 2  (Read 2927 times)

0 Members and 1 Guest are viewing this topic.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Help with SPARK 2
« on: March 01, 2012, 05:30:14 pm »
I am having big time problems to sucessfully render SPARK 2 particle systems, I always get a crash.

Already trying to solve it in SPARK forum, but still no solution.

If someone managed to use SFML 2 and SPARK 2, I would appreciate the help. Follows the pasted post of the SPARK forum.

http://spark.forum0.net/t146-renderer-crash


I've tried to create a minimal example that reproduces the error for me.
Code: [Select]

sf::RenderWindow window;
window.Create(sf::VideoMode(), "heye");

SPK::Ref<SPK::System> sparkSystem = SPK::System::create(true);

SPK::Ref<SPK::Group> effectgroup = sparkSystem->createGroup(400);
effectgroup->setName("Cool");
effectgroup->setRenderer(SPK::GL::GLPointRenderer::create(10));
effectgroup->addEmitter(SPK::SphericEmitter::create(SPK::Vector3D(1.0f,1.0f,-1.0f),0.0f,3.14159f,SPK::Sphere::create(SPK::Vector3D(),1.0f),true,-1,100.0f,0.2f,0.5f));
effectgroup->addModifier(SPK::Gravity::create(SPK::Vector3D(0.0f, 0.3,0.0f)));
effectgroup->addParticles(100, SPK::Vector3D(200,200,0), SPK::Vector3D());

while(window.PollEvent(sf::Event())){

}

sf::Clock c;
while(window.IsOpen()){
window.Clear();

sparkSystem->updateParticles(c.GetElapsedTime().AsSeconds());
c.Restart();

SPK::GL::GLRenderer::saveGLStates();
sparkSystem->renderParticles();
SPK::GL::GLRenderer::restoreGLStates();

window.Display();
}



Also, the Call Stack dies right there..

Code: [Select]
Sandbox.exe!SPK::System::renderParticles()  Line 206 + 0x16 bytes C++
  Sandbox.exe!SPK::Group::renderParticles()  Line 272 + 0x38 bytes C++
> Sandbox.exe!SPK::GL::GLPointRenderer::render(const SPK::Group & group, const SPK::DataSet * dataSet, SPK::RenderBuffer * renderBuffer)  Line 132 + 0x15 bytes C++



Its the same crash I get from the other application, but in this case it doesn't even render one frame, while in the other i see the snow flocks a little time :)

As you can see, i use the latest SFML 2 for windowing, we both know it is pretty good :)

When i mean latest, i mean from yesterday! I fetched the most recent versions of all libraries i use yesterday, compiled them all, and even changed to vs2010 from vs2008. So, different conditions, same problem.

Of course I can be compiling SPARK 2 wrong, but I pretty much compiled it with default settings..

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Help with SPARK 2
« Reply #1 on: March 01, 2012, 06:00:16 pm »
SFML enables the color component for GL vertex arrays, and leaves it activated as an optimization. So if SPARKS uses vertex arrays or vertex buffer objects, without a color component, it may be the cause of the crash.

Try to call glDisableClientState(GL_COLOR_ARRAY) before sparkSystem->renderParticles(). Same for texture coordinates, by the way.
Laurent Gomila - SFML developer

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Help with SPARK 2
« Reply #2 on: March 01, 2012, 07:44:41 pm »
Ohhhhh... makes sense! I've done that little change, and well, it kinda works..

I will test it better later, but for now it seems fine! And now i feel stupid!

Thanks Laurent!

Are there any other tips for using direct openGL in team with SFML 2?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Help with SPARK 2
« Reply #3 on: March 01, 2012, 10:33:07 pm »
Quote
And now i feel stupid

Well, you were not supposed to know about this internal detail. And I didn't until someone found it a few weeks ago ;)

Quote
Are there any other tips for using direct openGL in team with SFML 2?

None that I'm aware of. And this one is rather a bug that I need to fix.
Laurent Gomila - SFML developer

Roose Bolton of the Dreadfort

  • Full Member
  • ***
  • Posts: 113
  • Full-time Procrastinator, Part-time programmer.
    • View Profile
    • Personal Portfolio/Website/Blog
Re: Help with SPARK 2
« Reply #4 on: December 17, 2012, 06:16:15 pm »
Sorry to revive a dead thread, but did you manage to get this working Devil? I want to also use SPARK with SFML 2.0 but really don't want to go through weeks of debugging - is the transition difficult?
Trying so very hard to finish at-least one project.

Watch out for the RAII police, they will get you.

www.bantersaurus-games.com

 

anything