コード例 #1
0
void main(void)
{	
	void *classex, *jitclass;
	
	/*
	// Debug console window so printf works
	FILE* pCout; // should really be freed on exit 
	AllocConsole();
	freopen_s(&pCout, "CONOUT$", "w", stdout); 
	printf("jit_gl_spout_receiverSDK\n");
	*/
	post("jit_gl_spout_receiver - SDK Vers 2.001");

	// initialize our Jitter class
	jit_gl_spout_receiver_init();	
	
	// create our Max class
	setup((t_messlist **)&max_jit_gl_spout_receiver_class, 
		  (method)max_jit_gl_spout_receiver_new, 
		  (method)max_jit_gl_spout_receiver_free, 
		  (short)sizeof(t_max_jit_gl_spout_receiver), 
		  0L, A_GIMME, 0);
	
	// specify a byte offset to keep additional information about our object
	classex = max_jit_classex_setup(calcoffset(t_max_jit_gl_spout_receiver, obex));
	
	// look up our Jitter class in the class registry
	jitclass = jit_class_findbyname(gensym("jit_gl_spout_receiver"));	
	
	// wrap our Jitter class with the standard methods for Jitter objects
    max_jit_classex_standard_wrap(classex, jitclass, 0); 	
	
	// custom draw handler so we can output our texture.
	// override default ob3d bang/draw methods
	addbang((method)max_jit_gl_spout_receiver_bang);
	max_addmethod_defer_low((method)max_jit_gl_spout_receiver_draw, "draw");  
	
    #ifdef UseServers
	max_addmethod_defer_low((method)max_jit_gl_spout_receiver_getavailableservers, "getavailableservers");
	#else
	max_addmethod_defer_low((method)max_jit_gl_spout_receiver_getavailablesenders, "getavailablesenders");
	#endif
    
   	// use standard ob3d assist method
    addmess((method)max_jit_ob3d_assist, "assist", A_CANT,0);  
	
	// add methods for 3d drawing
    max_ob3d_setup();

	ps_jit_gl_texture = gensym("jit_gl_texture");
	ps_maxdraw = gensym("maxdraw");
	ps_out_name = gensym("out_name");
	ps_spoutsendername = gensym("SpoutSender");
    ps_clear = gensym("clear");

}
コード例 #2
0
// MAX 7
void ext_main(void *r)
{
	UNREFERENCED_PARAMETER(r);

	t_class *maxclass, *jitclass;

	/*
	// Debug console window so printf works
	FILE* pCout; // should really be freed on exit 
	AllocConsole();
	freopen_s(&pCout, "CONOUT$", "w", stdout); 
	printf("jit_gl_spout_receiver - Vers 2.0.6.0\n");
	*/

	// Show the version for reference
	#ifdef ENV64BIT
	post("jit_gl_spout_receiver - Vers 2.0.6.0 (64 bit)");
	#else
	post("jit_gl_spout_receiver - Vers 2.0.6.0 (32 bit)");
	#endif

	// initialize our Jitter class
	jit_gl_spout_receiver_init();	
	
	// create our Max class
	maxclass = class_new("jit.gl.spoutreceiver", 
						(method)max_jit_gl_spout_receiver_new,
						(method)max_jit_gl_spout_receiver_free, 
						sizeof(t_max_jit_gl_spout_receiver),
						NULL, A_GIMME, 0);

	// specify a byte offset to keep additional information about our object
	max_jit_class_obex_setup(maxclass, calcoffset(t_max_jit_gl_spout_receiver, obex));

	// look up our Jitter class in the class registry
	jitclass = (t_class *)jit_class_findbyname(gensym("jit_gl_spout_receiver"));	
	
	// wrap our Jitter class with the standard methods for Jitter objects
    max_jit_class_wrap_standard(maxclass, jitclass, 0);
	
	// custom draw handler so we can output our texture.
	// override default ob3d bang/draw methods
	class_addmethod(maxclass, (method)max_jit_gl_spout_receiver_bang, "bang", 0); // TODO - necessary ?
	class_addmethod(maxclass, (method)max_jit_gl_spout_receiver_draw, "draw", 0);
	class_addmethod(maxclass, (method)max_jit_gl_spout_receiver_getavailablesenders, "getavailablesenders", 0);

   	// use standard ob3d assist method
    class_addmethod(maxclass, (method)max_jit_ob3d_assist, "assist", A_CANT, 0); 

	
	// add methods for 3d drawing
	max_jit_class_ob3d_wrap(maxclass);

	ps_out_texture = gensym("jit_gl_texture");
	ps_maxdraw = gensym("maxdraw");
	ps_out_name = gensym("out_name");
	ps_spoutsendername = gensym("SpoutSender");
    ps_clear = gensym("clear");

	// register our class with max
	class_register(CLASS_BOX, maxclass);
	max_jit_gl_spout_receiver_class = maxclass;

}