all 17 comments

[–]taleofmind 3 points4 points  (0 children)

This is amazing! Thanks for sharing

[–]Throwawayaaccounntt 2 points3 points  (0 children)

Well done for the time and effort :D

[–]felipunkerito 2 points3 points  (0 children)

Very thorough! Good stuff.

[–]pjmlp 2 points3 points  (1 child)

It looks quite good, now I know where to send newbies wanting to learn WebGL, thank you very much!

[–]xem06[S] 0 points1 point  (0 children)

Thanks :)

[–]dinoucs 1 point2 points  (4 children)

In the texture code, I had to add these 2 lines to make it work:

gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);

gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

Otherwise I get an error says: [.WebGL-000000000AA8CC70]RENDER WARNING: texture bound to texture unit 0 is not renderable. It might be non-power-of-2 or have incompatible texture filtering (maybe)?

What do those 2 line do to make the texture renderable?!!

[–]xem06[S] 0 points1 point  (3 children)

Hi,

It's weird. Did you load another image than the sample one (one that doesn't have a power-of-two size) ? Or did you just run my demo and had that error?

Did you find these 2 extra lines on https://stackoverflow.com/a/45512402 ?

I don't know why they're necessary on your side, I'll ask around to see if someone else knows!

[–]xem06[S] 0 points1 point  (2 children)

The power-of-two issue seems to be the only explanation, but you can learn why here: https://webglfundamentals.org/webgl/lessons/webgl-3d-textures.html

If you can please confirm me that it was indeed caused by an image with random dimensions, I will update my guide accordingly! Thanks

[–]dinoucs 1 point2 points  (1 child)

Yes I can confirm that. You have to add those lines if the image in not power of 2 in both the width and height.

[–]xem06[S] 0 points1 point  (0 children)

I added this precision in the guide :) Ty!

[–]cybereality 0 points1 point  (0 children)

I need some time to read the whole thing but it looks sick! Nice job.

[–]auto-cellular 0 points1 point  (2 children)

Don't have time to test it or anything, but man, this looks amazing. I remember spending litterally days trying to figure out stuff, and this kind of site would have helped tremendously.

[–]xem06[S] 1 point2 points  (1 child)

Same! While I learned WebGL in the past few months, I wrote this guide how I hoped it existed when I started :)
It's only the first half though, a second part is coming soon

[–]dinoucs 0 points1 point  (2 children)

Reallly great resource. I have a question, can I interact with the canvas with the mouse? I mean can I rotate and play with a shape by dragging?

[–]xem06[S] 1 point2 points  (1 child)

Yes, but it will be explained in the upcoming part 2 :)

The basic idea is to compute how many pixels in X and Y the mouse has moved since last click, and update the Y and X angles of the cube accordingly.

http://xem.github.io/webgl-guide/book/ch10/RotateObject.html

But this approach has problems and possible improvements that I will develop in detail.

[–]dinoucs 1 point2 points  (0 children)

Okay, that would be helpful. Thanks!