void Canvas_Impl::setup(GraphicContext &new_gc) { gc = new_gc; if (!current_window.is_null()) { sc.connect(current_window.sig_window_flip(), bind_member(this, &Canvas_Impl::on_window_flip)); } gc_clip_z_range = gc.get_provider()->get_clip_z_range(); canvas_transform = Mat4f::identity(); if (gc.get_write_frame_buffer().is_null()) // No framebuffer attached to canvas { canvas_y_axis = y_axis_top_down; sc.connect(gc.get_provider()->sig_window_resized(), bind_member(this, &Canvas_Impl::on_window_resized)); } else { if (gc.get_texture_image_y_axis() == y_axis_bottom_up) { canvas_y_axis = y_axis_bottom_up; } else { canvas_y_axis = y_axis_top_down; } } update_viewport_size(); if (batcher.is_null()) { batcher = CanvasBatcher(gc); } }
AlError graphics_system_init() { BEGIN() TRY(algl_system_init()); glEnable(GL_SCISSOR_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); TRY(init_shaders()); glGenBuffers(1, &plainVertices); glBindBuffer(GL_ARRAY_BUFFER, plainVertices); float vertices[][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 8, vertices, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); update_viewport_size(); CATCH( graphics_system_free(); )
void Canvas_Impl::on_window_resized(const Size &size) { update_viewport_size(); }