示例#1
0
t_jit_err jit_gl_simple_init(void)
{
    long ob3d_flags = JIT_OB3D_NO_MATRIXOUTPUT; // no matrix output
    void *ob3d;

    _jit_gl_simple_class = jit_class_new("jit_gl_simple",
                                         (method)jit_gl_simple_new, (method)jit_gl_simple_free,
                                         sizeof(t_jit_gl_simple),A_DEFSYM,0L);

    // set up object extension for 3d object, customized with flags
    ob3d = jit_ob3d_setup(_jit_gl_simple_class,
                          calcoffset(t_jit_gl_simple, ob3d),
                          ob3d_flags);

    // define our OB3D draw method.  called in automatic mode by
    // jit.gl.render or otherwise through ob3d when banged. this
    // method is A_CANT because our draw setup needs to happen
    // in the ob3d beforehand to initialize OpenGL state
    jit_class_addmethod(_jit_gl_simple_class,
                        (method)jit_gl_simple_draw, "ob3d_draw", A_CANT, 0L);

    // define our dest_closing and dest_changed methods.
    // these methods are called by jit.gl.render when the
    // destination context closes or changes: for example, when
    // the user moves the window from one monitor to another. Any
    // resources your object keeps in the OpenGL machine
    // (e.g. textures, display lists, vertex shaders, etc.)
    // will need to be freed when closing, and rebuilt when it has
    // changed. In this object, these functions do nothing, and
    // could be omitted.
    jit_class_addmethod(_jit_gl_simple_class,
                        (method)jit_gl_simple_dest_closing, "dest_closing", A_CANT, 0L);
    jit_class_addmethod(_jit_gl_simple_class,
                        (method)jit_gl_simple_dest_changed, "dest_changed", A_CANT, 0L);

    // must register for ob3d use
    jit_class_addmethod(_jit_gl_simple_class,
                        (method)jit_object_register, "register", A_CANT, 0L);

    jit_class_register(_jit_gl_simple_class);

    return JIT_ERR_NONE;
}
示例#2
0
t_jit_err jit_gl_videoplane_init(void) 
{
	long attrflags=0;
	long ob3d_flags=0;
	t_jit_object *attr;
	void * ob3d;
	
	_jit_gl_videoplane_class = jit_class_new("jit_gl_videoplane", (method)jit_gl_videoplane_new, (method)jit_gl_videoplane_free,
		sizeof(t_jit_gl_videoplane),A_DEFSYM,0L);
	
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_jit_matrix,		"jit_matrix", 			A_USURP_LOW, 0);	
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_sendtexture,	"sendtexture", 			A_DEFER_LOW, 0);	

	// set up object extension for 3d object, customized with flags
	ob3d = jit_ob3d_setup(_jit_gl_videoplane_class, calcoffset(t_jit_gl_videoplane, ob3d), ob3d_flags);

	// add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"dim",_jit_sym_long,2,attrflags,
		(method)0L,(method)jit_gl_videoplane_dim,0/*fix*/,calcoffset(t_jit_gl_videoplane,dim));
	jit_attr_addfilterset_clip(attr,2,0,TRUE,FALSE);
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"displaylist",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_videoplane_displaylist,calcoffset(t_jit_gl_videoplane, displaylist));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"gridmode",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, gridmode));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"interp",_jit_sym_long,attrflags,
		(method)0L,(method)jit_gl_videoplane_interp,calcoffset(t_jit_gl_videoplane, interp));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"nudge",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, nudge));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tex_offset_x",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, tex_offset_x));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tex_offset_y",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, tex_offset_y));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tex_scale_x",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, tex_scale_x));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tex_scale_y",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, tex_scale_y));	
	jit_class_addattr(_jit_gl_videoplane_class,attr); 				
	attr = jit_object_new(_jit_sym_jit_attr_offset,"rect_tex",_jit_sym_long,attrflags,
		(method)0L,(method)jit_gl_videoplane_rect_tex,calcoffset(t_jit_gl_videoplane, rect_tex));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"client_storage",_jit_sym_long,attrflags,
		(method)0L,(method)jit_gl_videoplane_client_storage,calcoffset(t_jit_gl_videoplane, client_storage));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"colormode",_jit_sym_symbol,attrflags,
		(method)0L,(method)jit_gl_videoplane_colormode,calcoffset(t_jit_gl_videoplane, colormode));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	CLASS_ATTR_ENUM(_jit_gl_videoplane_class,"colormode",0,"argb uyvy");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"texturename",_jit_sym_symbol,attrflags,
		(method)0L,(method)jit_gl_videoplane_texturename,calcoffset(t_jit_gl_videoplane, texturename));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	

	// define our OB3D draw method.  called in automatic mode by 
	// jit.gl.render or otherwise through ob3d when banged. this 
	// method is A_CANT because our draw setup needs to happen 
	// in the ob3d beforehand to initialize OpenGL state 
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_draw, "ob3d_draw", A_CANT, 0L);
	
	// define our dest_closing and dest_changed methods. 
	// these methods are called by jit.gl.render when the 
	// destination context closes or changes: for example, when 
	// the user moves the window from one monitor to another. Any 
	// resources your object keeps in the OpenGL machine 
	// (e.g. textures, display lists, vertex shaders, etc.) 
	// will need to be freed when closing, and rebuilt when it has 
	// changed. 
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_dest_changed, "dest_changed",	A_CANT, 0L);
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_dest_closing, "dest_closing",	A_CANT, 0L);

	// rebuild_geometry is called if texture units or other 
	// attributes change requiring a rebuild
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_rebuild_geometry, "rebuild_geometry", 0L);
	
	// must register for ob3d	
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_object_register, 				"register",		A_CANT, 0L);

	jit_class_register(_jit_gl_videoplane_class);

	ps_bind				= gensym("bind");
	ps_unbind			= gensym("unbind");
	ps_jit_gl_texture	= gensym("jit_gl_texture");
	ps_rectangle		= gensym("rectangle");
	ps_colormode		= gensym("colormode");
	ps_mode				= gensym("mode");
	ps_static			= gensym("static");
	ps_dynamic			= gensym("dynamic");
	ps_drawto			= gensym("drawto");
	ps_texture			= gensym("texture");
	ps_filter			= gensym("filter");
	ps_linear			= gensym("linear");
	ps_nearest			= gensym("nearest");

	ps_gridmode			= gensym("gridmode");
	ps_nudge			= gensym("nudge");
	ps_tex_offset_x		= gensym("tex_offset_x");
	ps_tex_offset_y		= gensym("tex_offset_y");
	ps_tex_scale_x		= gensym("tex_scale_x");
	ps_tex_scale_y		= gensym("tex_scale_y");


	return JIT_ERR_NONE;
}
示例#3
0
t_jit_err jit_gl_lua_init(void)
{
	long attrflags=0;
	long ob3d_flags = 0;
	t_jit_object *attr;
	void *ob3d;
	
	jit_submatrix_wrapper_init();
	
	_jit_gl_lua_class = jit_class_new("jit_gl_lua",(method)jit_gl_lua_new,(method)jit_gl_lua_free,
		sizeof(t_jit_gl_lua),0L); //A_CANT = untyped
	
	// set up object extension for 3d object, customized with flags
	ob3d = jit_ob3d_setup(_jit_gl_lua_class, 
				calcoffset(t_jit_gl_lua, ob3d), ob3d_flags);

	// add ob3d methods
	jit_class_addmethod(_jit_gl_lua_class,
						(method)jit_object_register,		"register", A_CANT, 0L);
	jit_class_addmethod(_jit_gl_lua_class,
						(method)jit_gl_lua_call,			"call", A_GIMME, 0L);
	jit_class_addmethod(_jit_gl_lua_class,
						(method)jit_gl_lua_call_list,		"call_list", A_GIMME, 0L);
	jit_class_addmethod(_jit_gl_lua_class,
						(method)jit_gl_lua_draw,			"ob3d_draw", A_CANT, 0L);
	jit_class_addmethod(_jit_gl_lua_class,
						(method)jit_gl_lua_dest_changed,	"dest_changed", A_CANT, 0L);
	jit_class_addmethod(_jit_gl_lua_class,
						(method)jit_gl_lua_dest_closing,	"dest_closing", A_CANT, 0L);
	jit_class_addmethod(_jit_gl_lua_class, 
						(method)lua_filechanged,			"filechanged", A_CANT, 0);
	jit_class_addmethod(_jit_gl_lua_class, 
						(method)jit_gl_lua_drawinfo,		"drawinfo", A_CANT, 0);
	jit_class_addmethod(_jit_gl_lua_class,
						(method)jit_gl_lua_loadbang,		"loadbang", A_CANT, 0L);
	jit_class_addmethod(_jit_gl_lua_class,
						(method)jit_gl_lua_max_wrapper,		"max_wrapper", A_CANT, 0L);
	jit_class_addmethod(_jit_gl_lua_class,
						(method)jit_gl_lua_getmax_wrapper,	"getmax_wrapper", A_CANT, 0L);
	
	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	
	// autowatch
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"autowatch",_jit_sym_long,attrflags,
		(method)0L,(method)lua_autowatch,calcoffset(t_jit_gl_lua,autowatch));
	jit_class_addattr(_jit_gl_lua_class, attr);
	
	// file
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"file",_jit_sym_symbol,attrflags,
		(method)0L,(method)jit_gl_lua_setfile,calcoffset(t_jit_gl_lua,file));
	jit_class_addattr(_jit_gl_lua_class, attr);

	// gc
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"gc",_jit_sym_long,attrflags,
		(method)0L,(method)jit_gl_lua_setgc,calcoffset(t_jit_gl_lua,gc));
	jit_class_addattr(_jit_gl_lua_class, attr);
	
	attrflags |= JIT_ATTR_SET_OPAQUE;
	
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"path",_jit_sym_symbol,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_lua,path));
	jit_class_addattr(_jit_gl_lua_class, attr);
	
	// memsize
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"memsize",_jit_sym_long,attrflags,
		(method)jit_gl_lua_getmemsize,(method)0L,calcoffset(t_jit_gl_lua,memsize));
	jit_class_addattr(_jit_gl_lua_class, attr);
	
	// context
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"context",_jit_sym_long,attrflags,
		(method)jit_gl_lua_getcontext,(method)0L,calcoffset(t_jit_gl_lua,context));
	jit_class_addattr(_jit_gl_lua_class, attr);
	
	// last_inlet
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"last_inlet",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_lua,last_inlet));
	jit_class_addattr(_jit_gl_lua_class, attr);
	
	attrflags = JIT_ATTR_GET_OPAQUE_USER | JIT_ATTR_SET_OPAQUE_USER;
	
	// inlets
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"inlets",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_lua,inlets));
	jit_class_addattr(_jit_gl_lua_class, attr);
	
	// outlets
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"outlets",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_lua,outlets));
	jit_class_addattr(_jit_gl_lua_class, attr);
	
	// lua_unique_name
	attr = (t_object *)jit_object_new(_jit_sym_jit_attr_offset,"lua_unique_name",_jit_sym_symbol,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_lua, lua_unique_name));
	jit_class_addattr(_jit_gl_lua_class, attr);
		
	ps_jit_gl_lua_jit_matrix_wrapper = gensym("jit_matrix_wrapper");
	ps_jit_gl_lua_jit_submatrix_wrapper = gensym("jit_submatrix_wrapper");
	ps_jit_gl_lua_jit_lua_listener = gensym("jit_lua_listener");
	ps_jit_gl_lua_getmatrix = gensym("getmatrix");
	ps_jit_gl_lua_jit_matrix = gensym("jit_matrix");
	ps_jit_gl_lua_matrix_calc = gensym("matrix_calc");
	ps_jit_gl_lua_gettype = gensym("gettype");
	ps_jit_gl_lua_getsize = gensym("getsize");
	ps_jit_gl_lua_get = gensym("get");
	ps_jit_gl_lua_attribute = gensym("attribute");
	ps_nothing = gensym("nothing");
	ps_none = gensym("none");
	ps_drawinfo = gensym("drawinfo");

	jit_class_register(_jit_gl_lua_class);

	return JIT_ERR_NONE;
}
示例#4
0
t_jit_err jit_gl_hap_init(void) 
{
	void *ob3d;
	void *attr;
	long attrflags=0;
	long ob3d_flags = JIT_OB3D_NO_ROTATION_SCALE;
	ob3d_flags |= JIT_OB3D_NO_POLY_VARS;
	ob3d_flags |= JIT_OB3D_NO_BLEND;
	ob3d_flags |= JIT_OB3D_NO_TEXTURE;
	ob3d_flags |= JIT_OB3D_NO_MATRIXOUTPUT;
	ob3d_flags |= JIT_OB3D_AUTO_ONLY;
	ob3d_flags |= JIT_OB3D_NO_DEPTH;
	ob3d_flags |= JIT_OB3D_NO_ANTIALIAS;
	ob3d_flags |= JIT_OB3D_NO_FOG;
	ob3d_flags |= JIT_OB3D_NO_LIGHTING_MATERIAL;
	ob3d_flags |= JIT_OB3D_NO_SHADER;
	ob3d_flags |= JIT_OB3D_NO_BOUNDS;
	ob3d_flags |= JIT_OB3D_NO_COLOR;	
	
	_jit_gl_hap_class = jit_class_new("jit_gl_hap", 
		(method)jit_gl_hap_new, (method)jit_gl_hap_free,
		sizeof(t_jit_gl_hap),A_DEFSYM,0L);
	
	ob3d = jit_ob3d_setup(_jit_gl_hap_class, calcoffset(t_jit_gl_hap, ob3d), ob3d_flags);

	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_draw,			"ob3d_draw", A_CANT, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_dest_closing, "dest_closing", A_CANT, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_dest_changed, "dest_changed", A_CANT, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_object_register,		"register", A_CANT, 0L);

	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_read,			"read", A_GIMME, 0);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_sendoutput,	"sendoutput", A_DEFER_LOW, 0L);
	
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_dispose,	"dispose",	A_USURP_LOW, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_start,	"start",	A_DEFER_LOW, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_stop,		"stop",		A_DEFER_LOW, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_jump,		"jump",		A_DEFER_LOW, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_frame,	"frame",	A_DEFER_LOW, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_clear_looppoints,	"clear_looppoints", A_DEFER_LOW, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_loadram,	"loadram",	A_DEFER_LOW, 0L);
	jit_class_addmethod(_jit_gl_hap_class, (method)jit_gl_hap_loadram,	"unloadram",A_DEFER_LOW, 0L);
	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	
	//attr = jit_object_new(_jit_sym_jit_attr_offset,"adapt",_jit_sym_char,attrflags,
	//	(method)0L,(method)0L,calcoffset(t_jit_gl_hap,adapt));
	//jit_class_addattr(_jit_gl_hap_class,attr);
	//object_addattr_parse(attr,"style",_jit_sym_symbol,0,"onoff");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"dim",_jit_sym_long,2,attrflags,
		(method)0L,(method)0L,0,calcoffset(t_jit_gl_hap,dim));
	jit_class_addattr(_jit_gl_hap_class,attr);
	
	//attr = jit_object_new(_jit_sym_jit_attr_offset_array,"rect",_jit_sym_float32,4,attrflags,
	//	(method)0L,(method)0L,0,calcoffset(t_jit_gl_hap,rect));
	//jit_class_addattr(_jit_gl_hap_class,attr);
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"time",_jit_sym_long,attrflags,
		(method)jit_gl_hap_time_get,(method)jit_gl_hap_time_set,0L);
	jit_class_addattr(_jit_gl_hap_class,attr);
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"loop",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_hap_loop_set,calcoffset(t_jit_gl_hap,loop));
	jit_class_addattr(_jit_gl_hap_class,attr);
	object_addattr_parse(attr,"style",_jit_sym_symbol,0,"enumindex");
	object_addattr_parse(attr,"enumvals",_jit_sym_atom,0,"off normal palindrome playback-limits");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"autostart",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_hap,autostart));
	jit_class_addattr(_jit_gl_hap_class,attr);
	object_addattr_parse(attr,"style",_jit_sym_symbol,0,"onoff");
		
	attr = jit_object_new(_jit_sym_jit_attr_offset,"rate",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_hap_rate_set,calcoffset(t_jit_gl_hap,rate));
	jit_class_addattr(_jit_gl_hap_class,attr);
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"vol",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_hap_vol_set,calcoffset(t_jit_gl_hap,vol));
	jit_class_addattr(_jit_gl_hap_class,attr);	
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"rate_preserves_pitch",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_hap,rate_preserves_pitch));
	jit_class_addattr(_jit_gl_hap_class,attr);
	object_addattr_parse(attr,"style",_jit_sym_symbol,0,"onoff");
		
	attr = jit_object_new(_jit_sym_jit_attr_offset,"loopstart",_jit_sym_long,attrflags,
		(method)0L,(method)jit_gl_hap_loopstart,calcoffset(t_jit_gl_hap,looppoints[0]));
	jit_class_addattr(_jit_gl_hap_class,attr);
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"loopend",_jit_sym_long,attrflags,
		(method)0L,(method)jit_gl_hap_loopend,calcoffset(t_jit_gl_hap,looppoints[1]));
	jit_class_addattr(_jit_gl_hap_class,attr);
	
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"looppoints",_jit_sym_long,2,attrflags,
		(method)0L,(method)jit_gl_hap_looppoints,0,calcoffset(t_jit_gl_hap,looppoints));
	jit_class_addattr(_jit_gl_hap_class,attr);
		
	attr = jit_object_new(_jit_sym_jit_attr_offset,"loopreport",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_hap,loopreport));
	jit_class_addattr(_jit_gl_hap_class,attr);
	object_addattr_parse(attr,"style",_jit_sym_symbol,0,"onoff");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"framereport",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_hap, framereport));
	jit_class_addattr(_jit_gl_hap_class,attr);
	object_addattr_parse(attr,"style",_jit_sym_symbol,0,"onoff");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"out_name",_jit_sym_symbol, attrflags,
		(method)jit_gl_hap_getattr_out_name,(method)jit_gl_hap_setattr_out_name,0);
	jit_class_addattr(_jit_gl_hap_class,attr);	

	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_OPAQUE_USER;
	attr = jit_object_new(_jit_sym_jit_attr_offset,"fps",_jit_sym_float32,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_hap,fps));
	jit_class_addattr(_jit_gl_hap_class,attr);
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"duration",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_hap,duration));
	jit_class_addattr(_jit_gl_hap_class,attr);
			
	attr = jit_object_new(_jit_sym_jit_attr_offset,"timescale",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_hap,timescale));
	jit_class_addattr(_jit_gl_hap_class,attr);
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"framecount",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_hap,framecount));
	jit_class_addattr(_jit_gl_hap_class,attr);
				
	// hide default ob3d attrs that aren't used
	attrflags = JIT_ATTR_GET_OPAQUE_USER | JIT_ATTR_SET_OPAQUE_USER;
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"position",_jit_sym_float32,3,attrflags,
		(method)0L,(method)0L,0,0);
	jit_class_addattr(_jit_gl_hap_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"anchor",_jit_sym_float32,3,attrflags,
		(method)0L,(method)0L,0,0);
	jit_class_addattr(_jit_gl_hap_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"anim",_jit_sym_symbol, attrflags,
		(method)0L,(method)0L,0);
	jit_class_addattr(_jit_gl_hap_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"animmode",_jit_sym_symbol, attrflags,
		(method)0L,(method)0L,0);
	jit_class_addattr(_jit_gl_hap_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"filterclass",_jit_sym_symbol, attrflags,
		(method)0L,(method)0L,0);
	jit_class_addattr(_jit_gl_hap_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"layer",_jit_sym_long,attrflags,
		(method)0L,(method)0L,0L);
	jit_class_addattr(_jit_gl_hap_class,attr);
	
	jit_class_register(_jit_gl_hap_class);

	ps_bind = gensym("bind");
	ps_unbind = gensym("unbind");
	ps_width = gensym("width");
	ps_height = gensym("height");
	ps_glid = gensym("glid");	
	ps_draw = gensym("draw");

	return JIT_ERR_NONE;
}
t_jit_err jit_gl_terrain_init(void) 
{
	long attrflags=0;
	long ob3d_flags=0;
	t_jit_object *attr;
	void * ob3d;

	//try to add matrix inside
		t_atom a;
	void *o,*mop;

	_jit_gl_terrain_class = jit_class_new("jit_gl_terrain", (method)jit_gl_terrain_new, (method)jit_gl_terrain_free,
		sizeof(t_jit_gl_terrain),A_CANT,0L); //A_CANT = untyped
	
	// set up object extension for 3d object, customized with flags
	ob3d = jit_ob3d_setup(_jit_gl_terrain_class, calcoffset(t_jit_gl_terrain, ob3d), ob3d_flags);

/*
	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,2,1);
	jit_mop_single_type(mop,_jit_sym_char);	
	o = jit_object_method(mop,_jit_sym_getinput,2);
	jit_attr_setlong(o,_jit_sym_dimlink,0);
	jit_atom_setlong(&a,256);
	jit_object_method(o,_jit_sym_mindim,1,&a);
	jit_object_method(o,_jit_sym_maxdim,1,&a);
	jit_class_addadornment(_jit_gl_terrain_class,mop);

*/

	// add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;

	// jkc email method
//	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_jit_matrix, "jit_matrix",A_USURP_LOW, 0);	



	// shape
	attr = jit_object_new(_jit_sym_jit_attr_offset,"shape",_jit_sym_symbol,attrflags,
		(method)0L,(method)jit_gl_terrain_shape,calcoffset(t_jit_gl_terrain, shape));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"dim",_jit_sym_long,2,attrflags,
		(method)0L,(method)jit_gl_terrain_dim,0/*fix*/,calcoffset(t_jit_gl_terrain,dim));
	jit_attr_addfilterset_clip(attr,2,0,TRUE,FALSE);
	jit_class_addattr(_jit_gl_terrain_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"displaylist",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_terrain_displaylist,calcoffset(t_jit_gl_terrain, displaylist));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"gridmode",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, gridmode));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	


	attr = jit_object_new(_jit_sym_jit_attr_offset,"calc_norms",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, calc_norms));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	//doesnt work right now. cant call gl ops from draw_grid
	attr = jit_object_new(_jit_sym_jit_attr_offset,"draw_norms",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, draw_norms));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	attr = jit_object_new(_jit_sym_jit_attr_offset,"shift",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_terrain_shift,calcoffset(t_jit_gl_terrain, shift));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	attr = jit_object_new(_jit_sym_jit_attr_offset,"dir",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_terrain_shift,calcoffset(t_jit_gl_terrain, shift));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

//	post("before attrib_jit_sym_float32\, MAXGRID\, attrflags\,");
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"pos",_jit_sym_float32, MAXGRID, attrflags,		//add 64floats to pos
		(method)0L,(method)jit_gl_terrain_pos,0/*fix*/,calcoffset(t_jit_gl_terrain, pos));	
//	jit_attr_addfilterset_clip(attr,MAXGRID,0,TRUE,FALSE);
	jit_class_addattr(_jit_gl_terrain_class,attr);	
//	post("after attrib_jit_sym_float32\, MAXGRID\, attrflags\,");


	attr = jit_object_new(_jit_sym_jit_attr_offset,"om",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, om));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	attr = jit_object_new(_jit_sym_jit_attr_offset,"getindice",0L,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, getindice));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	


	//added 27.4.2004
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"coords",_jit_sym_float32,2,attrflags,
		(method)0L,(method)jit_gl_terrain_coords,0/*fix*/,calcoffset(t_jit_gl_terrain,coords));
	jit_class_addattr(_jit_gl_terrain_class,attr);	



	//heaedxyz method from gl_ruttetra; get to find which y we want
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"head_xyz",_jit_sym_float32,3,attrflags,
		(method)0L,(method)jit_gl_terrain_head_xyz,0/*fix*/,calcoffset(t_jit_gl_terrain,head_xyz));
//s	jit_attr_addfilterset_clip(attr,2,0,TRUE,FALSE);
	jit_class_addattr(_jit_gl_terrain_class,attr);	
	
	
		//max gldim
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"maxdim",_jit_sym_long,2,attrflags,
		(method)0L,(method)jit_gl_terrain_maxdim,0/*fix*/,calcoffset(t_jit_gl_terrain,maxdim));
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	// handle draw method.  called in automatic mode by jit.gl.render, or otherwise through ob3d when banged.
	// this is A_CANT because draw setup needs to happen in the ob3d beforehand. 
	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_draw, "ob3d_draw", A_CANT, 0L);
	
	// handle dest_changed method.
	// this method is called by jit.render when the destination context changes: for example,
	// when the user moves the window from one monitor to another.  Anything your object keeps
	// in the OpenGL machine -- textures, display lists, vertex shaders, etc. -- will need to
	// be rebuilt here. 
	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_dest_changed, "dest_changed", A_CANT, 0L);


	
	// must register for ob3d	
	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_object_register, 			"register",		A_CANT, 0L);
	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_dest_closing, 	"dest_closing",	A_CANT, 0L);


	//add matrix methods
//	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);


	// jkc fix
//	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_jit_matrix, "jit_matrix",A_USURP_LOW, 0);	



	jit_class_register(_jit_gl_terrain_class);

	ps_terrain 			= gensym("terrain");

	return JIT_ERR_NONE;
}