java, gridshape and textures

May 25, 2008 at 9:16am

java, gridshape and textures

I’m trying to apply a single texture(a picture file) to each one of these planes created in I’m having trouble figuring it out. from the jitter tutorials i can’t quite understand how to get the qtmovie into the object.
A suggestion into the right direction would be greatly appreciated.

here’s my code so far.

var planes = 20; //number of particles

//jit.window creation
var mywindow = new JitterObject(“jit.window”,”wallpaper”);
mywindow.depthbuffer = 0;
mywindow.idlemouse = 0;

var mymatrix = new JitterMatrix(4,”char”,320,240);
var myqtmovie = new JitterObject(“”, 320, 240);

// creation
var myrender = new JitterObject(“”,”wallpaper”);
//use a 2d projection
myrender.ortho = 2;
myrender.erase_color = [0,0,0,1];

//attempt 1 at addig a texture
var mytexture = new JitterObject(“”,”wallpapaper”);
mytexture.texture = “mymatrix”; = “flowers”;

// create an array of [] objects randomly arrayed across the window
var myplane = new Array(planes);

//for statment to create the planes
for(var i=0;i

myplane[i] = new JitterObject(“”,”wallpaper”);
myplane[i].shape = “plane”;
myplane[i].lighting_enable = 1;
myplane[i].smooth_shading = 1;
myplane[i].scale = [0.05,0.05,0.05];
myplane[i].color = [0.5,0.3,0.7,0.5];
myplane[i].position = [Math.random()*2.-1,Math.random()*2.-1];
myplane[i].blend_enable = 1;
myplane[i].texture = “picture”;

//copied in
function read(filename) // read a movie
if(arguments.length==0) {
// no movie specified, so open a dialog;
else { // read the movie specified;
// initialize feedback matrix to all maximum values
mymatrix.setall(255, 255, 255, 255);

// drive the renderer
function bang()

myqtmovie.matrixcalc(mymatrix, mymatrix);

// rendering block…
myrender.erase(); // erase the drawing context
myrender.drawclients(); // draw the client objects
myrender.swap(); // swap in the new drawing

May 26, 2008 at 3:46pm

Although i do know Java, I know next to nothing about Jitter and Java, but from glancing at your code this line is using a special kind of paper for its drawing context:

var mytexture = new JitterObject(“”,”wallpapaper”);

Dunno for certain, but could be it, right?

May 27, 2008 at 9:15am

On Sun, May 25, 2008 at 10:16 AM, adam synnott wrote:

> //attempt 1 at addig a texture
> var mytexture = new JitterObject(“”,”wallpapaper”);
> mytexture.texture = “mymatrix”;
> = “flowers”;

Texture doesn’t have an attribute “texture”, since that would mean you’re
texturing a texture :) To get your matrix data into the texture use
mytexture.matrixcalc() or something. I see you were attempting that before,
but you have to call in on the texture, with the video matrix as the
argument. I’m not sure if you can call it with as an argument

You matrix name is set to “flowers” ….

> myplane[i].texture = “picture”;

while your plane is textured with “picture”.

And of course, like Bas pointed out, the context name of your texture has a



You must be logged in to reply to this topic.