[SOLVED] Apply a shader to a geometry

I’m currently trying to add a shader to a 3D geometry, but it gets applied to the canvas instead.
I can’t understand what I am missing, any help would be very appreciated.

Here’s my code: https://codepen.io/kekkorider/full/yRvbzm/

1 Like

i just try that first time, but

works, and when you include
orbitControl();
and exchange
rect(0,0,width,height);
with
box(40);
ok

3 Likes

Thanks for your reply @kll

I managed to figure out what was the problem: the vertex shader was totally wrong.
First i needed the uProjectionMatrix and uModelViewMatrix uniforms, than I had to calculate gl_Position with this formula:

gl_Position = uProjectionMatrix * uModelViewMatrix * vec4(aPosition, 1.0);

Not it’s working like a charm!

2 Likes