Closed Andrew-web-coder closed 8 months ago
Hi! 1) Yes, sorry it's not ideally named but "move" is used to update any property of an object ... 2) I can't give you a definitive answer, because this demo overloads the cube's transformation matrix completely, so the cube scaling must be manually included in the custom matrix. On any other demo, size (or w / h / d) work normally to scale the cube up. You can also move or resize the camera to approach or zoom on the cube. As for pixels, unfortunately WebGL doesn't know pixels, they only know a single arbitrary unit of size, and I default every object to 1 unit of size. (you can think of it as 1 meter if it helps, but you can't translate it to px) 3) yep, use w / h / d instead of size 4) Not with the default cube, but you can create your own custom cube made of 6 planes, each plane having its own texture and/or color.
Thank you very much for the answers. I'm reading your WebGL tutorial now and it's starting to make more sense.
@xem I am very sorry, but I have another question - how to update one particular texture. My goal is to put video on the model, I found https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Animating_textures_in_WebGL and it seems that I need to run both gl.bindTexture(..)
and gl.texImage2D(..)
, right? I am struggling to figure out how to execute them correctly. Also, I need to run it only when video is playing.
Hello! That's out of the scope of W, my tuto or my knowledge. However, Mozilla did a demo of this here: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/By_example/Video_textures The source code is quite short, and it seems to me that there is a hidden <video> player somewhere in the page, and at each frame of the program, the current frame of the video is copied on a 2D canvas, which is in turn used as a 2D texture for webgl
Hello, I just found your project and it looks great! But I have a few questions:
W.move({n:"mario", size : ....
?1
and increase/decrease with small steps, but I do not understand what is1
.bricks
, but other -trees
?Thanks!