render-to-texture

How to use video element or html content as a face texture in three.js?

核能气质少年 提交于 2021-02-16 09:21:26
问题 I am looking to use a video texture for a face in three.js. I know this is fairly easy to do if you have the video data. But what would I do if I only have the element it is playing from? For example: How would I play a youtube video and copy the video or player onto a face in three.js? 回答1: There is an example of integrating Three.js and YouTube videos at http://threejs.org/examples/css3d_youtube.html#cats and examples of including general HTML elements (using CSS3D) at http:/

Texture does not fit in the square - OpenGL

老子叫甜甜 提交于 2021-02-08 08:32:51
问题 I am trying to create a square and put a red circle middle of it. As you can see in the simple vert I map (-1, 1) range to (0,1) range: coord = position.xy*0.5 + vec2(0.5,0.5); If you look at the simple.frag, there is this line: if(abs(length(coord - vec2(0.5,0.5))) < 0.3) Thus I am expecting red circle at the middle of square. However this happens: The center of circle is beyond of (0.5, 0.5). If I change that line to this: if(abs(length(coord - vec2(0.0,0.0))) < 0.3) Output is: The center

Texture does not fit in the square - OpenGL

不羁的心 提交于 2021-02-08 08:32:25
问题 I am trying to create a square and put a red circle middle of it. As you can see in the simple vert I map (-1, 1) range to (0,1) range: coord = position.xy*0.5 + vec2(0.5,0.5); If you look at the simple.frag, there is this line: if(abs(length(coord - vec2(0.5,0.5))) < 0.3) Thus I am expecting red circle at the middle of square. However this happens: The center of circle is beyond of (0.5, 0.5). If I change that line to this: if(abs(length(coord - vec2(0.0,0.0))) < 0.3) Output is: The center

How to use video element or html content as a face texture in three.js?

拈花ヽ惹草 提交于 2021-01-29 09:24:08
问题 I am looking to use a video texture for a face in three.js. I know this is fairly easy to do if you have the video data. But what would I do if I only have the element it is playing from? For example: How would I play a youtube video and copy the video or player onto a face in three.js? 回答1: There is an example of integrating Three.js and YouTube videos at http://threejs.org/examples/css3d_youtube.html#cats and examples of including general HTML elements (using CSS3D) at http:/

ClassCaseException on GL11ExtensionPack. Rendering to texture on OpenGL android

时光怂恿深爱的人放手 提交于 2020-01-25 11:19:46
问题 I'm trying to render to a texture (really thought it would be easier than this!) I found this resource: which seems to be exactly what I want I'm getting a ClassCastException however, on GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl; Can anyone tell me why? public void renderToTexture(GLRenderer glRenderer, GL10 gl) { boolean checkIfContextSupportsExtension = checkIfContextSupportsExtension(gl, "GL_OES_framebuffer_object"); if(checkIfContextSupportsExtension) { GL11ExtensionPack gl11ep =

ClassCaseException on GL11ExtensionPack. Rendering to texture on OpenGL android

寵の児 提交于 2020-01-25 11:19:09
问题 I'm trying to render to a texture (really thought it would be easier than this!) I found this resource: which seems to be exactly what I want I'm getting a ClassCastException however, on GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl; Can anyone tell me why? public void renderToTexture(GLRenderer glRenderer, GL10 gl) { boolean checkIfContextSupportsExtension = checkIfContextSupportsExtension(gl, "GL_OES_framebuffer_object"); if(checkIfContextSupportsExtension) { GL11ExtensionPack gl11ep =

Render to 16bits unsigned integer 2D texture in WebGL2

99封情书 提交于 2020-01-25 04:36:05
问题 As stated in the WebGL 2 official specs or docs (look here), gl.RGBA16UI internal size format is a color-renderable format. That means I should be able to render to a RGBA16UI texture. I can easily fill a texture with an UInt16Array and then use it. But I fail filling a texture rendering into it with a shader. Then, I only get zeros when I sample the values in the next shader. Did anyone already succeed in rendering to an unsigned integer texture with WebGL 2 ? I would be very grateful, I'm