Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawing a polygon panics if two consecutive points are equal as of v0.15 #689

Open
redFrik opened this issue Dec 13, 2020 · 0 comments
Open

Comments

@redFrik
Copy link

redFrik commented Dec 13, 2020

here is a stripped down example that makes nannou 0.15 panic. in 0.14.1 it works ok.
i have noticed the same issue with geom::path::Builder::new() and line_to.

use nannou::prelude::*;
fn main() {
    nannou::sketch(view).size(640, 480).run();
}
fn view(app: &App, frame: Frame) {
    let draw = app.draw();
    frame.clear(BLACK);
    
    let p1 = pt2(100.0, 100.0);
    let p2 = pt2(100.0, 100.0); //if p2 is equal to p1 nannou v0.15 crashes. no to so in v0.14.1
    //let p2 = pt2(100.0, -100.0); //here no problem
    
    let mut points = Vec::new();
    points.push((pt2(0.0, 0.0), rgb(1.0, 1.0, 0.8)));
    points.push((p1, rgb(0.0, 0.0, 0.0)));
    points.push((p2, rgb(0.0, 1.0, 0.0)));
    points.push((pt2(-100.0, -100.0), rgb(1.0, 0.0, 0.0)));
    draw.polygon().points_colored(points);
    draw.to_frame(app, &frame).unwrap();
}

macOS 10.14.6, rustc 1.48.0

thread 'main' panicked at 'assertion failed: `(left != right)`
  left: `0`,
 right: `0`', /Users/Stirling/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.5.2/src/lib.rs:940:9
stack backtrace:
   0: _rust_begin_unwind
   1: std::panicking::begin_panic_fmt
   2: wgpu::Device::create_buffer_mapped
   3: wgpu::Device::create_buffer_with_data
   4: nannou::draw::renderer::Renderer::encode_render_pass
   5: nannou::draw::renderer::Renderer::render_to_frame
   6: nannou::app::<impl nannou::draw::Draw>::to_frame
   7: line_to::view
   8: nannou::app::run_loop::{{closure}}
   9: <winit::platform_impl::platform::app_state::EventLoopHandler<T> as winit::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event
  10: winit::platform_impl::platform::app_state::Handler::handle_nonuser_event
  11: winit::platform_impl::platform::app_state::AppState::cleared
  12: ____CFXPCCreateCFObjectFromXPCObject_block_invoke
  13: ___CFRunLoopObserverCancel
  14: ___CFRunLoopRun
  15: ___CFTSRToDispatchTime
  16: _RunCurrentEventLoopInMode
  17: _ReceiveNextEventCommon
  18: __BlockUntilNextEventMatchingListInModeWithFilter
  19: __DPSNextEvent
  20: -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
  21: -[NSApplication run]
  22: winit::platform_impl::platform::event_loop::EventLoop<T>::run
  23: winit::event_loop::EventLoop<T>::run
  24: nannou::app::SketchBuilder<E>::run
  25: line_to::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@mitchmindtree mitchmindtree changed the title panic with equals points in v0.15 Drawing a polygon panics if two consecutive points are equal as of v0.15 Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants