javascript null class pointer creating jit.gl.text3d
Hey folks, I am trying to create some gl objects from javascript. I seem to be able to create a "jit.gl.gridshape" with no problem. But when I try to create a "jit.gl.text3d", I get the following error:
jsjitterobject_Constructor: null class pointer jit_gl_text3d
Is there any reason why I would not be able to create this object?
create a "jit.gl.text" and set the "mode" attribute to "3d"
Ahhh I see, got it. It is working now. Thanks!
Another quick question...
I am trying to send a message to "jit.gl.text" to set the text. Here is my code...
var gridShapeLabel = new JitterObject("jit.gl.text", context);
gridShapeLabel.message("text", "Test");
I get the following error: js: testcode.js: Javascript TypeError: gridShapeLabel.message is not a function, line 79
Is there something I am missing here? What is the best practice for sending a jitter object a message?
Any ideas?
gridShapeLabel.text("Test");
Okay I am slowly getting there, thanks for your help.
I have an example patch where I define a jit.gl.render where I am trying to add some jit.gl.text from javascript. Here is my test patch and code. Is there any reason why my text is not showing up?
autowatch = 1;
// variables
var renderer;
var context = "journey-ctx"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function findObj(objname)
{
var obj = this.patcher.firstobject;
while(obj != null)
{
if(obj.varname == objname)
return obj;
nextobj = obj.nextobject;
if(obj == nextobj )
break;
else
obj = nextobj ;
}
return null;
}
function bang()
{
renderer = findObj("theRenderer");
if(renderer == null){
post("Error: could not find renderer");
return;
}
var gridShapeLabel = new JitterObject("jit.gl.text", context);
gridShapeLabel.text = "some text";
gridShapeLabel.gl_color = "1. 1. 1. 1.";
gridShapeLabel.align = 1;
gridShapeLabel.fontsize = 20;
gridShapeLabel.mode = "3d";
post("creating text");
}
Any one have an idea what I may be missing?
your syntax on the text message is still incorrect. compare it to what i posted in my last reply.
you also need to set array attributes with arrays, not strings, e.g. gridShapeLabel.gl_color = [1, 1, 1, 1];
Okay got it now. Thanks!