Share
Embed
Transcript
6 slides
-
Tuesday, May 31, 2011 10:11 AM GEM Base // After
objects below you in the chain have finished. // You should reset all GEM/OpenGL states here. // If you care about the start of rendering // If you care about the stop of rendering // has rendering started ? // If anything in the object has changed // check whether this object has changed // The outlet // this gets called in the before the startRendering() routine // if it returns TRUE, the object's startRendering(), render() and stopRendering() functions will be called // it it returns FALSE, the object will be disabled // when rendering is restarted, this function get's called again // the default is to enable rendering // this function is important if you want to disable an object because it cannot be used (e.g. missing driver support) // creation callback /* whether the object is internally disabled or not * objects are to be disabled, if the system cannot make use of them, e.g. because of unsupported openGL features -
Tuesday, May 31, 2011 9:09 AM GEM State class GEM_EXTERN
TexCoord { public: TexCoord() : s(0.f), t(0.f) { } TexCoord(float s_, float t_) : s(s_), t(t_) { } float s; float t; }; struct GEM_EXTERN pixBlock { pixBlock(); ////////// // the block's image imageStruct image; ////////// // is this a newimage since last time? // ie, has it been refreshed int newimage; ////////// // keeps track of when new films are loaded // useful for rectangle_textures on OSX int newfilm; }; -
Monday, May 30, 2011 7:54 PM GEM Outlet m_outKeyState =
outlet_new(this->x_obj, 0); m_outKeyVal = outlet_new(this->x_obj, 0); outlet_free(m_outKeyState); outlet_free(m_outKeyVal); void gemkeyname :: KeyNamePressed(char *string, int val, int state) outlet_symbol(m_outKeyVal, gensym(string)); outlet_float(m_outKeyVal, (t_float)val); Identifier outlet_new(this->x_obj, 0); post("shader '%s' will be loaded when rendering is turned on (openGL context needed)", filename->s_name); -
Monday, May 30, 2011 8:04 PM GEM More inlet m_vector[0]
= atom_getfloat(&argv[0]); m_vector[1] = atom_getfloat(&argv[1]); m_vector[2] = atom_getfloat(&argv[2]); ARGUMENT inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("xVal")); inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("yVal")); inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("zVal")); INLET 1.Setup Callback obj_setupCallback 2.Callback Func msg identifier -
Monday, May 30, 2011 7:18 PM GEM Inlet anatomy 1.
inlet_new(this->x_obj, &this->x_obj->ob_pd, gensym("list"), gensym("vert_pos")); Bikin inlet di object (INIT) berurutan, inlet otomatis geser 2. inlet_new(this->x_obj, &this->x_obj->ob_pd, gensym("list"), gensym("vert_size")); Fungsi Callback Diarahkan lewat obj_setupCallback(t_class *classPtr) Menerima List Pengenal (utk callback) Inisialisasi Callback FUNGSI CALLBACK -
Tuesday, May 31, 2011 9:09 AM GEM Image Struct /
PixUtil UTILITY: GEM_EXTERN extern void copy2Image(imageStruct *to, imageStruct *from); // assumes that it only has to refresh the data GEM_EXTERN extern void refreshImage(imageStruct *to, imageStruct *from); struct GEM_EXTERN pixBlock { pixBlock(); ////////// // the block's image imageStruct image; ////////// // is this a newimage since last time? // ie, has it been refreshed int newimage; ////////// // keeps track of when new films are loaded // useful for rectangle_textures on OSX int newfilm; }; unsigned char *data; // the pointer to the data