thecocce / zengl

Automatically exported from code.google.com/p/zengl
0 stars 0 forks source link

Particle Engine gets SIGSEGV error, after Non looped particle stops #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Easy, just add a non looped emitter to your scene

What is the expected output? What do you see instead?
Well, I just need to add a simple non looped particle to my game, to make some 
hit effect. But, when the it finishes (not emitting anymore)after 1-2 seconds I 
get SIGSEGV Error. On looped emitters everything works fine.

What version of the product are you using? On what operating system? With
what compiler - Delphi/FreePascal?
ZenGL 0.3.11 i386-Win32 FPC2.6.0 with Lazarus v1.0.10

Please provide any additional information below.
The ZenGL_PG works fine compiled from source, and the demo13 too, but if I load 
a non-looped emitter into it, I get's the same.

it's not helping if I try to variate with Particles.List[9].Time and 
Particles.List[9].Life .

Original issue reported on code.google.com by punkosdm...@gmail.com on 11 Jan 2014 at 9:29

GoogleCodeExporter commented 9 years ago
First of all update to ZenGL 0.3.12. Then try to use debug mode to find the 
line of crash. I will take a look on problem a bit later, but problem is 
strange. I thought maybe you trying to access emitter which is destroyed(so you 
need to do check for nil), but in standard demo there is no any additional 
actions with emitters.

Original comment by dr.andru@gmail.com on 13 Jan 2014 at 9:23

GoogleCodeExporter commented 9 years ago
I took released ZenGL Particles Editor, opened emitter_rain.zei and unchecked 
Loop. Set "Emitter life" to 5 sec. Everything is fine with editor and with 
standard demo in debug mode. Same with other emitters. So, can you please 
update ZenGL to the last version and use Lazarus at least 1.0.14 with FPC 
2.6.2? If you get the same error, please use debug mode for demo and provide me 
number of line with crash.

Original comment by dr.andru@gmail.com on 13 Jan 2014 at 8:03

GoogleCodeExporter commented 9 years ago
Well, I tried it in debug mode, it seems like, every time i try to access it, 
it fails(like it try to set the time to 0, to make it emit again, a little 
~0.8sec "animation"). I added nil check, it works, the emitter goes into nil, 
after sometime, but I haven't find a way, to make it stay "not nil" forever. If 
I emitting fast like every sec, there's no problem. I created a particle myself 
with PE 1.0.8 (you can take a look at here: 
http://users.atw.hu/your-share/punkosdmarcell/Storage/almostsmoke2.zei ) I have 
updated, to ZenGL 0.3.12 but it have the same issue.

Original comment by punkosdm...@gmail.com on 14 Jan 2014 at 2:31

GoogleCodeExporter commented 9 years ago
Oh, then this is not a bug at all. You just need to understand how it works. 
Into zglPEmitter2D variable you load an emitter. This will be just a loaded 
*.zei file. Then you need to create a new instance of this emitter to draw and 
process it. So add new zglPEmitter2D variable(e.g. emitterInstance) and use it 
with pengine2d_AddEmitter like this:

pengine2d_AddEmitter( emitterLoaded, @emitterInstance, ... );

now you can check emitterInstance for nil, and if you want to emit it again 
after it gets nil, just call function above again. For drawing we use here 
pengine2d_Draw and pengine2d_Proc to process emitters(see demo13).

Original comment by dr.andru@gmail.com on 14 Jan 2014 at 6:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Well, this method gives me a very very very little unsensable (226 -> 222) FPS 
drop, but it not crashes now. Thanks :) And keep up the good work!

Original comment by punkosdm...@gmail.com on 14 Jan 2014 at 10:12