Video Texture on OpenGL in Javascript
How do I apply a video texture to openGL objects in Javascript? I've looked through the documentation and can't seem to find it.
I'm just modifying tutorial 47 at the moment, this is what I have so far. I think i'm just missing a name but I'm not sure the syntax for arguements in GL objects:
//set video texture from movie
var myvideo = new JitterObject("jit.qt.movie", 320, 240);
//set Matrix for video
var mymatrix = new JitterMatrix(4, "char", 320, 240);
//Read a movie
function read(filename)
{
if(arguments.length==0) {
//no movie specified, so open a dialog
myvideo.read();
}
else {myvideo.read(filename);
}
}
//create texture
var tex1 = new JitterObject("jit.gl.texture", "ListenWindow");
// create a [jit.gl.gridshape] object for use to control with the mouse
var mywidget = new JitterObject("jit.gl.gridshape","ListenWindow");
mywidget.shape = "sphere";
mywidget.lighting_enable = 1;
mywidget.smooth_shading = 1;
mywidget.texture = tex1;
mywidget.scale = [0.1,0.1,0.1];
mywidget.color = [1,1,1,0.5] ;
mywidget.blend_enable = 1;
mywidget.position = [0,0];
the texture attribute takes a string of the texture name, not the object itself.
mywidget.texture = tex1.name;
wes
On 11/16/07, Andrew Roth wrote:
>
> How do I apply a video texture to openGL objects in Javascript? I've looked through the documentation and can't seem to find it.
>
> I'm just modifying tutorial 47 at the moment, this is what I have so far. I think i'm just missing a name but I'm not sure the syntax for arguements in GL objects:
>
> //set video texture from movie
> var myvideo = new JitterObject("jit.qt.movie", 320, 240);
> //set Matrix for video
> var mymatrix = new JitterMatrix(4, "char", 320, 240);
> //Read a movie
> function read(filename)
> {
> if(arguments.length==0) {
> //no movie specified, so open a dialog
> myvideo.read();
> }
> else {myvideo.read(filename);
> }
> }
> //create texture
> var tex1 = new JitterObject("jit.gl.texture", "ListenWindow");
>
> // create a [jit.gl.gridshape] object for use to control with the mouse
> var mywidget = new JitterObject("jit.gl.gridshape","ListenWindow");
> mywidget.shape = "sphere";
> mywidget.lighting_enable = 1;
> mywidget.smooth_shading = 1;
> mywidget.texture = tex1;
> mywidget.scale = [0.1,0.1,0.1];
> mywidget.color = [1,1,1,0.5] ;
> mywidget.blend_enable = 1;
> mywidget.position = [0,0];
>
Thanks! That helps a lot!
:)
Is there a good guide or resource for learning Javascript in Max? Seems I haven't quite got the hang of it yet.
check out the examples folder. That covers alot of things.
wes
On 11/17/07, Andrew Roth wrote:
>
> Thanks! That helps a lot!
>
> :)
>
> Is there a good guide or resource for learning Javascript in Max? Seems I haven't quite got the hang of it yet.
>