void render_surface::paint(Gtk::Window* window, bool change, bool vis) // if change, install appropriate cursor { gl_begin(); { python::gil_lock L; if (change and !vis) { std::cerr << "cursor.visible = 0 is not yet supported on Linux." << std::endl; } /* TODO: The following doesn't work because window is a high-level GtkA::Window, * and we need a low-level GdkWindow in gdk_window_set_cursor. Not clear how to proceed. if (change) { if (!arrow_cursor) { arrow_cursor = gdk_cursor_new(GDK_ARROW); blank_cursor = gdk_cursor_new(GDK_BLANK_CURSOR); // blank cursor not yet available in Ubuntu 20090401 } if (vis) { gdk_window_set_cursor(window, arrow_cursor); } else { gdk_window_set_cursor(window, blank_cursor); } } */ core.render_scene(); // render the scene } gl_end(); }
void render_surface::gl_swap_buffers() { gl_begin(); get_gl_window()->swap_buffers(); glFinish(); // Ensure rendering completes here (without the GIL) rather than at the next paint (with the GIL) gl_end(); }
virtual void do_draw_overlay( const ui::paint_event_t& event) const { RAMEN_ASSERT( node()->composition()); move2d_node_t::matrix3_type lm( param_->matrix_at_frame( node()->composition()->frame(), node()->aspect_ratio())); Imath::V2f p = get_absolute_value<Imath::V2f>( param_->center_param()); p = p * lm; p.x *= node()->aspect_ratio(); gl_line_width( default_line_width()); manipulators::draw_xy_axes( p, 70 / event.pixel_scale, 70 / event.pixel_scale, get_value<float>( param_->rotate_param()), event.aspect_ratio / node()->aspect_ratio(), ui::palette_t::instance().color("x_axis"), ui::palette_t::instance().color("y_axis"), event.pixel_scale); manipulators::draw_cross( p, 3 / event.pixel_scale, 3 / event.pixel_scale, default_color(), event.pixel_scale); manipulators::draw_ellipse( p, 7 / event.pixel_scale, 7 / event.pixel_scale, Imath::Color3c( 255, 255, 255), 20); // draw the boundary move2d_node_t::matrix3_type gm( node()->global_matrix()); gm *= move2d_node_t::matrix3_type().setScale( move2d_node_t::vector2_type( node()->aspect_ratio(), 1)); Imath::Box2i bbox( node()->format()); ++bbox.max.x; ++bbox.max.y; float offset = manipulators::shadow_offset( event.pixel_scale); gl_line_width( manipulator_t::default_line_width()); gl_point_size( manipulator_t::default_control_point_size()); // shadow gl_color3ub( 0, 0, 0); gl_begin( GL_LINE_LOOP); manipulators::gl_transformed_box( bbox, gm, offset); gl_end(); // color gl_color( manipulator_t::default_color()); gl_begin( GL_LINE_LOOP); manipulators::gl_transformed_box( bbox, gm); gl_end(); }
void display::gl_swap_buffers() { if (!window_visible) return; gl_begin(); SwapBuffers( dev_context); glFinish(); // Ensure rendering completes here (without the GIL) rather than at the next paint (with the GIL) gl_end(); }
void quad_manipulator_t::do_draw_overlay( const ui::paint_event_t& event) const { boost::array<Imath::V2f, 4> dst_pts; get_corners( dst_pts, event.aspect_ratio); gl_line_width( default_line_width()); gl_point_size( default_control_point_size()); // shadow float off = manipulators::shadow_offset( event.pixel_scale); gl_color3ub( 0, 0, 0); gl_begin( GL_LINE_LOOP); for( int i = 0; i < 4; ++i) gl_vertex2f( dst_pts[i].x + off, dst_pts[i].y + off); gl_end(); gl_begin( GL_POINTS); for( int i = 0; i < 4; ++i) gl_vertex2f( dst_pts[i].x + off, dst_pts[i].y + off); gl_end(); // color gl_color( default_color()); gl_begin( GL_LINE_LOOP); for( int i = 0; i < 4; ++i) gl_vertex2f( dst_pts[i].x, dst_pts[i].y); gl_end(); // draw corners gl_begin( GL_POINTS); for( int i = 0; i < 4; ++i) { if( i != picked_corner_) gl_vertex2f( dst_pts[i].x, dst_pts[i].y); } gl_end(); for( int i = 0; i < 4; ++i) { if( i == picked_corner_) manipulators::draw_small_box( dst_pts[i], 3 / event.pixel_scale); } }
void display::paint() { // called by render_manager "paint_displays" if (!window_visible) return; gl_begin(); { python::gil_lock gil; if (cursor.visible != cursor.last_visible) { cursor.last_visible = cursor.visible; // The following code locks the invisible cursor to its window. if (!cursor.visible) { RECT rcClip; GetWindowRect(widget_handle, &rcClip); ClipCursor(&rcClip); } else { ClipCursor(0); } ShowCursor(cursor.visible); } render_scene(); } gl_end(); }