EffectWrapper - Properly set a custom attribute

Hi,

I’ve almost succeeded in adapting a cool particle shader with some ping-pong RTT buffer. Here’s a playground with the minimal requirements. I’m facing some WebGL warnings.

On line 104 and above in the playground, I pass an array of indices (a_index) to my vertex shader EffectWrapper. I’m doing it directly with some GL code. I suppose I missed something as I’m getting ‘GL_INVALID_OPERATION: Must have element array buffer bound.

https://playground.babylonjs.com/#FF8A2R

Is there a proper way to pass this attribute? I found ‘indexParameters’ in EffectWrapperCreationOptions, not sure if this is related to my use case?"
Anyway, if someone has an idea, or has already faced this case, I’m waiting for advice :star_struck:!
Here, I’ve intentionally removed the last effect that manages the particles’ lifespan to avoid to much code the playground.

effect source : github

You should not mix gl commands with Babylon render functions, here’s how to port the code to Babylon (lines 100 to 130):

2 Likes

:grinning_face: :grinning_face: Thank you very much @Evgeni_Popov for your answer and for showing me the proper way to achieve that.

1 Like