FLAMEGPU / FLAMEGPU2-visualiser

Cross platform real-time OpenGL visualiser for FLAMEGPU2 models.
1 stars 2 forks source link

Visualising multiple agents catches a debug assert. #35

Closed Robadob closed 3 years ago

Robadob commented 3 years ago

An assert for checking textures are bound correctly triggers when a 2nd agent is added to ModelVis.

https://github.com/FLAMEGPU/FLAMEGPU2_visualiser/blob/fafafb242496d709976176fecfa99ef682117829/src/shader/ShaderCore.cpp#L192

After commenting that out, I found a second bug, where if a Z var isn't provided we get a memcpy cuda error. Wrapping it with an if statement to check null ptr, fixes that issue.

https://github.com/FLAMEGPU/FLAMEGPU2_visualiser/blob/fafafb242496d709976176fecfa99ef682117829/src/Visualiser.cpp#L371

Now the visualisation runs, however the first agent now only moves in the Y axis (as opposed to Y + X). If i edit the code, so the 2nd agent isn't visualised, the 1st works as expected. Similarly, if I switch around components, location_y always works, location_x never works.

Lots to be investigated here, seems likely that the 1st and 3rd issues are linked. Code for the example can be found here. https://github.com/FLAMEGPU/FLAMEGPU2_dev/tree/visualise_direction

Robadob commented 3 years ago

@MILeach You have been visualising multiple agents/states, have you not come across any similar issues?

Robadob commented 3 years ago

I reworked how texture units are assigned. They were all just being assigned 3, this would have broken down worse after custom colours had been merged. I also stopped texture unit 0 from being used (it's kind of used the cleanse switching to 0, so safer to avoid using it intentionally.

Tested the example again and it had been fixed.