Page MenuHome

Blender 2.8: OpenGL: immediate mode for wm_gesture.c (+ needed vert and frag shaders for dashed lines)
ClosedPublic

Authored by Willian Padovani Germano (ianwill) on Nov 24 2016, 2:40 AM.

Details

Summary

This implements immediate mode for multiple functions in wm_gesture.c, but there's still one function to be done*. Mike: already posting this so you can get rid of sdrawbox, like talked.

To test this patch invoke these tools in the 3d viewport:

  1. Box selection (press b): notice first the cross, then click and drag to see the box.
  2. Circle selection (c): change its radius with the mouse wheel.
  3. Lasso selection (control + left mouse button click and drag)
  4. I didn't find what invokes the function that draws a single dashed line, so I left a commented tmp line in the patch (#262 in wm_gesture.c), uncomment it to test (the line appears as diagonal for the box selection).

The exact look of the dashed lines can be tweaked by changing the shader uniforms in wm_gesture.c: "dash_width" and "dash_width_on", like in the original shaders by merwin**.

I'd like feedback about a few things:

  • If the dashed lines created by these shaders are a good substitute / if the shaders are ok.
  • I had to create new functions: imm_draw_line_box_dashed() and imm_draw_lined_dashed_circle(), for now they are both in wm_gesture.c. Since both are only used by a single function each I can simply embed their code in the callers, or do you prefer to have them in glutil.c?
  • Should I already use the new matrix API instead of gl_ModelViewProjectionMatrix in the vert shader?

(*) I need to get more information about how to substitute glPixelTransferf in draw_filled_lasso(), it's used to draw the shaded interior drawn by the lasso tool.
(**) Thanks Mike (merwin) for his 3d dashed lines vert and frag shaders, the 2d ones here are based on his work.

Diff Detail

Repository
rB Blender

Event Timeline

Willian Padovani Germano (ianwill) retitled this revision from to Blender 2.8: OpenGL: immediate mode for wm_gesture.c (+ needed vert and frag shaders for dashed lines).
Willian Padovani Germano (ianwill) set the repository for this revision to rB Blender.

Thanks for using the new COMP and PRIM enums!

More notes coming soon...

source/blender/windowmanager/intern/wm_gesture.c
419
gt->type == WM_GESTURE_LASSO
Mike Erwin (merwin) edited edge metadata.
This revision is now accepted and ready to land.Feb 24 2017, 9:55 PM

Landed in blender2.8, woohoo!

source/blender/windowmanager/intern/wm_gesture.c
419

fixed in final commit