View Full Version : Problem video texture

04-22-2011, 06:31 AM
Hi !!

To begin I'm french so excuse me if my english is not very good.

I am in internship and I work with WebGL.
I want to make a video with a texture and using <video>.
The code runs in local but doesn't run in my virtual host.
And the code runs in chrome perfectly but not in Firefox (Just the video) and I don't understand why.

The error is :

gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, textureVideo.image);

uncaught exception: [Exception... "Failure arg 5 [nsIDOMWebGLRenderingContext.texImage2D]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://www.web_3d.com.localhost/Javascript/Texture.js :: loadedTextureVideo :: line 70" data: no]

I think the video is not loaded correctly and that's why I have this error. But not certainly.

function loadedTextureVideo (video) {

//gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
gl.bindTexture(gl.TEXTURE_2D, video);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video.image);
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);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.bindTexture(gl.TEXTURE_2D, null);


Please help me !!

Thanks :)