PistonDevelopers / gfx_debug_draw

Simple debug renderer (lines, text, etc) for gfx
MIT License
7 stars 5 forks source link

Updated dependencies #63

Closed bvssvni closed 8 years ago

bvssvni commented 8 years ago
bvssvni commented 8 years ago

@kvark I am trying to get the line renderer working by changing create_pipeline_simple into this:

let set = factory.create_shader_set(&VERTEX_SRC[1], &FRAGMENT_SRC[1]).unwrap();
let mut rasterizer = gfx::state::Rasterizer {
    front_face: gfx::state::FrontFace::CounterClockwise,
    cull_face: gfx::state::CullFace::Nothing,
    method: gfx::state::RasterMethod::Line(1),
    offset: None,
    samples: None,
};
let pso = try!(factory.create_pipeline_state(
    &set, gfx::Primitive::LineList, rasterizer, pipe::new()
));

Still not working. Any ideas?

kvark commented 8 years ago

This code looks good to me. Could you provide an apitrace dump?

bvssvni commented 8 years ago

Previous:

prev.trace.zip

Update:

upd.trace.zip

bvssvni commented 8 years ago

I'm looking through the traces, trying to make sense of it.

This looks suspicious:

280 glViewport(x = 0, y = 0, width = 0, height = 0)
kvark commented 8 years ago

Thanks @bvssvni ! I can see 2 draw calls a frame. One is GL_LINES, another is GL_TRIANGLES. I assume we are investigating the first one. There are at least 2 differences being apparent:

  1. the count of elements to draw. Prev uses glDrawArrays(mode = GL_LINES, first = 0, count = 20), while Upd uses glDrawArrays(mode = GL_LINES, first = 0, count = 64)
  2. the polygon mode. Prev uses glPolygonMode(face = GL_FRONT_AND_BACK, mode = GL_FILL), while Upd uses glPolygonMode(face = GL_FRONT_AND_BACK, mode = GL_LINE)

For an experiment, perhaps you could try using state::Rasterizer::new_fill() for the rasterizer parameter?

bvssvni commented 8 years ago

It works! I changed to Rasterizer::new_fill and saw a glimpse of some lines. It was the z-buffer not being cleared to 1.0 before rendering.

bvssvni commented 8 years ago

Perhaps the z buffer should be disabled?

kvark commented 8 years ago

@bvssvni Good! I believe this library draws both on-screen and in the world space. So Z is needed.

bvssvni commented 8 years ago

Added support for flexible target. The only thing left is shader picking, but this requires gfx_app or a way to map version for the shader_version library.

Merging.

kvark commented 8 years ago

\o/

On Jul 17, 2016, at 12:20, Sven Nilsen notifications@github.com wrote:

Merged #63.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.