Forums > Javascript

jit.gl.text2d created with javascript not working ?


August 30, 2010 | 3:13 pm

please help,
i have a simple stripped down javascript, that should write some text in a window with jit.gl.text2d.
i can see the axes of jit.gl.text2d, but not the text.
in the example below i include a jit.gl.gridshape just to show, that this one works fine.
any ideas?
thanks
klaus

autowatch = 1;
var window = new JitterObject("jit.window","thewin");
window.depthbuffer = 1;
window.idlemouse = 1;
var render = new JitterObject("jit.gl.render","thewin");
render.ortho = 2;
var tt,ss;

tt = new JitterObject("jit.gl.gridshape","thewin");
tt.scale = [0.1,0.1,0.1];
tt.position = [Math.random()-0.5,Math.random()-0.5,0];
tt.shape = "plane";
tt.lighting_enable = 1;
tt.smooth_shading = 1;

ss = new JitterObject("jit.gl.text2d","thewin");
ss.text = "ertz";
ss.size = 78;
ss.axes = 1;
ss.position = [Math.random()-0.5,Math.random()-0.5,0];

function bang()
{

render.erase();
render.drawclients();
render.swap();
}

August 30, 2010 | 8:31 pm

Sounds like a depth buffering issue. You may way to disable depth buffeting for your text object and explicitly render after the gridshape.

-Joshua

August 30, 2010 | 9:19 pm

i try ..
and turn off depth buffering here with depth_enable = 0
but the following still does not show my text:

autowatch = 1;
var window = new JitterObject("jit.window","thewin");
window.depthbuffer = 0;
window.idlemouse = 1;
var render = new JitterObject("jit.gl.render","thewin");
render.ortho = 2;
var ss;

ss = new JitterObject("jit.gl.text2d","thewin");
ss.text = "ertz";
ss.size = 78;
ss.axes = 1;
ss.depth_enable = 0;

function bang()
{

render.erase();
render.drawclients();
render.swap();
}

August 29, 2012 | 5:34 am

you can use ss.text("ertz"); syntax instead of ss.text = "ertz".
i had a same problem. i wish Max has more detail reference about javascript :)

August 30, 2012 | 3:56 pm

The difference between ss.text("foobar") and (say) ss.depth_enable=0 is that text is a message to jit.gl.text2d while depth_enable is an attribute.

This is actually all documented fairly clearly in the Max reference.

Javascript will, of course happily allow you to shoot yourself in the kneecap as much as you want, but that’s another story.

BTW, size is another message that you’re treating as an attribute in the posted code.

Always remember:

- Max messages are functions in Javascript
- Max attributes are attributes in Javascript (you can set and get using simple assignment)

Ignore those two rules at your own peril

January 23, 2015 | 5:35 am

Hi there!
I have have some problem with this object too but I’m developping in Java.

I can easily code and chain jitter object and render it to a videoplane and a window.
I thought I got the logic on how it works but now when I try to instantiate this object like this :

this.jit_text2d = new JitterObject("jit.gl.text2d", this.context);

the max console says : Could not instantiate class jit.gl.text2d

I don’t get it. May that be a bug?

I also tried

this.jit_text2d = new JitterObject("jit.gl.text2d");	
this.jit_text2d.setAttr("drawto", this.context);

because I found that for jit.gl.pix object we cannot pass the context as the second argument but we must declare it afterwards as an attribute .

But it won’t work, am I missing something? is there a specific logic to the jit.gl.text2d?

If someone has a clue of what might cause this error?
I’m on Max 7 32bits Win 7.

January 23, 2015 | 6:19 am

re,
ok I guess this object as well as jit.gl.text3d doesn’t exist in the java world
instead jit.gl.text does
I’ll try with that then

January 23, 2015 | 12:01 pm

yes use jit.gl.text @mode 2d. jit.gl.text2d is simply an alias for this.

Viewing 8 posts - 1 through 8 (of 8 total)

Forums > Javascript