Error : getProgramCacheKey in change from r75 to r110

I modifed some old code depends on three.js r75.
And I tried to update three.js version to r110, below error occured.

three.js:18469 Uncaught TypeError: Cannot read property ‘toString’ of undefined
at WebGLPrograms.getProgramCacheKey (three.js:18469)
at initMaterial (three.js:24915)
at setProgram (three.js:25119)
at WebGLRenderer.renderBufferDirect (three.js:24133)
at renderObject (three.js:24894)
at renderObjects (three.js:24864)
at WebGLRenderer.render (three.js:24641)

In old code, they use EffectComposer, MaskPass, RenderPass, ShaderPass, CopyShader, Horiziontal/VerticalBlurShader.

I changed only import path but I fix some error below, so I attach the line what I modified too.

BEFORE -> MODIFIED
renderer.context -> renderer.getContext()
uv.setDynamic(true) -> uv.setUsage(THREE.DynamicReadUsage)
position.setDynamic(true) -> position.setUsage(THREE.DynamicReadUsage)
renderTarget.activeCubeFace = cubeFace -> renderer.setRenderTarget(renderTarget, cubeFace)
renderer.render(scene, camera, renderTarget, false) -> renderer.render(scene, camera)

I fixed getProgramCacheKey error, it’s because I didn’t change the other code relate to old revision.

But after fixed that error I got another errors like below

(1) WebGL: INVALID_ENUM: bufferData: invalid usage
(2) three.js:15014 WebGL: INVALID_VALUE: bufferSubData: buffer overflow
(3) [.WebGL-0x7ff69f032400]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 0
(4) [.WebGL-0x7ff69f032400]GL ERROR :GL_INVALID_OPERATION : glDrawArrays: Source and destination textures of the draw are the same.

What code did I change wrong? maybe setDynamic to setUsage or activeCubeFace?

I fix errors (1), (2), (3) by change setUsage(THREE.DynamicReadUsage) -> setUsage(THREE.DynamicDrawUsage)

and fix error (4) by add code renderer.setRenderTarget(null) below renderer.render(scene, camera)

1 Like