struct nodeInstanceData * nodeInstanceInit(void) { struct nodeInstanceData * instance = (struct nodeInstanceData *)malloc(sizeof(struct nodeInstanceData)); VuoRegister(instance, free); instance->glContext = VuoGlContext_use(); instance->imageRenderer = VuoImageRenderer_make(instance->glContext); VuoRetain(instance->imageRenderer); instance->shader = VuoShader_makeUnlitColorShader( VuoColor_makeWithRGBA(1.,1.,1.,1.) ); VuoRetain(instance->shader); return instance; }
instance->imageRenderer = VuoImageRenderer_make(instance->glContext); VuoRetain(instance->imageRenderer); return instance; } void nodeInstanceEvent ( VuoInstanceData(struct nodeInstanceData *) instance, VuoInputData(VuoColor, {"default":{"r":1,"g":1,"b":1,"a":1}}) color, VuoInputData(VuoInteger, {"default":640, "suggestedMin":1, "suggestedStep":32}) width, VuoInputData(VuoInteger, {"default":480, "suggestedMin":1, "suggestedStep":32}) height, VuoOutputData(VuoImage) image ) { VuoShader shader = VuoShader_makeUnlitColorShader(color); VuoRetain(shader); // Render. *image = VuoImageRenderer_draw((*instance)->imageRenderer, shader, width, height, VuoImageColorDepth_8); VuoRelease(shader); } void nodeInstanceFini(VuoInstanceData(struct nodeInstanceData *) instance) { VuoRelease((*instance)->imageRenderer); VuoGlContext_disuse((*instance)->glContext); }