Hi everyone, I am facing this error: TypeError: Failed to execute 'shaderSource' on 'WebGL2RenderingContext': parameter 1 is not of type 'WebGLShader'.
The problem only appears if I render more than 16 objects at the same time; I tried with 15 objects, and it still works.
//tech
<div className="flex flex-row flex-wrap justify-center gap-10">
{/* {console.log(data)} */}
{data.map((tech: any, index: any) => (
<div className="h-28 w-28" key={tech.index}>
{/* <BallTech icon={tech.icon} wait={(index + 3) * 1000} /> */}
<div className="bg-blue-900 text-white">{tech.icon}</div>
</div>
))}
</div>
// BallTech.tsx
import {
Decal,
Float,
useTexture,
OrbitControls,
Preload,
Html,
} from "@react-three/drei";
import { Canvas } from "@react-three/fiber";
import React, { Suspense, useEffect, useState } from "react";
import CanvasLoader from "./Loader";
const BallTech = (props: any) => {
const [decal] = useTexture([props.imgUrl]);
return (
<Float speed={2} rotationIntensity={1} floatIntensity={2}>
<ambientLight intensity={1} />
<directionalLight position={[0, 0, 0.05]} intensity={1} />
<mesh castShadow receiveShadow scale={2.75}>
<icosahedronGeometry args={[1, 1]} />
<meshStandardMaterial
color="#ffffff"
polygonOffset
polygonOffsetFactor={-10}
flatShading
roughness={0}
/>
<Decal
position={[0, 0, 1]}
rotation={[0, 0, 0]}
scale={1}
map={decal}
/>
</mesh>
</Float>
);
};
const BallCanvas: React.FC<any> = ({ icon, wait }) => {
const [hidden, setHidden] = useState("hidden");
console.log(wait);
console.log(icon);
useEffect(() => {
const timerId = setTimeout(() => {
show();
}, wait);
return () => {
clearTimeout(timerId);
};
}, [wait]);
const show = () => {
setHidden("");
};
return (
<Canvas frameloop="always" gl={{ preserveDrawingBuffer: true }}>
<Suspense fallback={<CanvasLoader />}>
{/* <OrbitControls enableZoom={false} maxPolarAngle={2} minPolarAngle={1} /> */}
<OrbitControls enableZoom={false} />
<BallTech imgUrl={`/tech/${icon}`} />
<Preload all />
</Suspense>
</Canvas>
);
};
export default BallCanvas;
I am using NextJS, typescript, ThreeJS, TailwindCSS
Thank you guys