VALUE ray_image_target_alloc(VALUE self) { if (!say_image_target_is_available()) rb_raise(rb_eRuntimeError, "Ray::RenderImage is not supported here"); say_image_target *target = say_image_target_create(); return Data_Wrap_Struct(ray_cImageTarget, NULL, say_image_target_free, target); }
/* * Unbinds any image target * * This is rarely needed, as this method gets called automatically when a window * is bound, and because windows and image targets do not share the same OpenGL * context. */ VALUE ray_image_target_unbind(VALUE self) { /* * No need for an error when this is not supported, because it just means * we don't need to unbind anything. */ if (say_image_target_is_available()) say_image_target_unbind(); return Qnil; }
/* * Checks availability of image targets * * Image targets are only part of OpenGL core since OpenGL 3 (although they may * be supported as an extension in older versions). * * @return [true, false] True when ImageTargets are available */ VALUE ray_image_target_available(VALUE self) { return say_image_target_is_available() ? Qtrue : Qfalse; }
void say_image_target_unbind() { if (say_image_target_is_available()) say_fbo_make_current(0); }