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:
- Box selection (press b): notice first the cross, then click and drag to see the box.
- Circle selection (c): change its radius with the mouse wheel.
- Lasso selection (control + left mouse button click and drag)
- 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.