Spector.js icon indicating copy to clipboard operation
Spector.js copied to clipboard

TypeError: Array.prototype.slice called on null or undefined

Open NickPowers43 opened this issue 9 years ago • 8 comments

Forgive me if Spector.js is not intended to work in any WebGL application including those which may not use WebGL correctly.

The Issue

While working on a WebGL2 project I kept getting a null/undefined reference exception here when hitting the record button in the Spector.js Chrome extension.

It seems the call to gl.getVertexAttrib is returning undefined.

image

A little background on the project

The goal of this project is to use the GPU to simulate the interaction between a collection of particles. Since the particles can interact with any other particle I have to use a combination of textures and VBOs to fetch the vertex attributes. For this reason the vertex positions are being stored in a texture and the rest are stored in the VBO since the position of the particles are the only relevant attributes to neighboring vertices. That means I have to setup a FBO as well as a transform feedback object to write the output of the simulation to both the VBO and the texture.

Here are the source files: main.js particlesim.vs particlesim.fs

Despite calling gl.uniform1i(positionTexLoc, theirTex); I get RENDER WARNING: there is no texture bound to the unit 0. Which I assume means the sampler in the vertex shader is not being set.

I predict this may be what is causing the error in Spector.js.

NickPowers43 avatar May 15 '17 01:05 NickPowers43

Hello,

This looks like an interesting project you got.

As the main goal of Spector is to troubleshoot what happens in your context, it should definitely not crash in case of specific l usage like your case or even wrong use of the context. It should still help understanding what is happening.

I will fix it for the next release planned next week end. Thank you for reporting the issue.

Do you have an online page I could use to repro ?

Thx,

sebavan avatar May 15 '17 03:05 sebavan

Hi sebavan,

I plan on putting the project on Github. Let me do that and you can try it out. After further debugging I realized I was set my texture uniforms incorrectly so that is what was causing the RENDER WARNING: there is no texture bound to the unit 0 warning.

NickPowers43 avatar May 15 '17 03:05 NickPowers43

Thanks

sebavan avatar May 15 '17 03:05 sebavan

Here you go. Just run a simple web server in the root directory. https://github.com/NickPowers43/TreeOnTheHill

NickPowers43 avatar May 17 '17 02:05 NickPowers43

Perfect thank you, I l fix it tomorrow evening and release this week end on Chrome

sebavan avatar May 17 '17 03:05 sebavan

sorry for the delay, won t be able to do it before the week end with the extension.

sebavan avatar May 18 '17 08:05 sebavan

No problem. Keep me posted.

On Thu, May 18, 2017 at 4:01 AM, sebavan [email protected] wrote:

sorry for the delay, won t be able to do it before the week end with the extension.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BabylonJS/Spector.js/issues/33#issuecomment-302331091, or mute the thread https://github.com/notifications/unsubscribe-auth/ABtQL4Sb5ODg1IwH3Pua2pIshcDY4kMmks5r6_rdgaJpZM4Nalal .

NickPowers43 avatar May 18 '17 13:05 NickPowers43

You can side load the extension to test, I ll publish soon the new version on the store.

sebavan avatar May 22 '17 07:05 sebavan