Page MenuHome

blender 2.8: OpenGL immediate mode: area
ClosedPublic

Authored by Punya Biswal (punya) on Nov 16 2016, 3:40 PM.

Details

Summary

Starting work on area.c, divided up into several Git commits within this revision for my sanity. (Arc isn't working for me, for some reason, so I'm going to keep using git format-patch + copy-paste).

Broad question: this file resets the VertexFormat several times, and I'm worried that it'll be hard to see when a call to some utility function resets a vertex format when I'm not expecting it. Does this concern make sense, or does the library "take care of it" (like old-style glPushMatrix)? If it makes sense, is it worth creating a naming convention for functions that do or don't reset the vertex format?

Diff Detail

Repository
rB Blender

Event Timeline

Punya Biswal (punya) retitled this revision from to blender 2.8: OpenGL immediate mode: area.
Punya Biswal (punya) updated this object.
Punya Biswal (punya) set the repository for this revision to rB Blender.

Forgot to unbind program last time!

Wondering whether I should tackle interface_draw.c in a separate diff before converting the parts of this file that use UI_draw_roundbox_*.

  • ED_region_panels
  • ED_region_do_draw
  • draw_azone_plus

For your broader questions:
Gawain remembers as little as possible, there is no push/pop of vertex format. There *is* push/pop for matrices though!

Whenever possible, group related draws together so they can share vertex format, or even share a Begin/End pair. It's ok to rewrite or reorganize code to make this happen. As long as you test it :)

source/blender/editors/screen/area.c
227

The immUniformColor calls only work with UNIFORM_COLOR shaders. Use different shader here.

572

Use UNIFORM_COLOR shader here.

Punya Biswal (punya) edited edge metadata.

Flat -> Uniform shader where applicable.

Punya Biswal (punya) marked 2 inline comments as done.Nov 17 2016, 4:19 PM

Caught and fixed a couple more instances of the same (copy-paste) mistake.

Looks good so far. All done with area.c?

The diffs look fine here, so whatever diff/patch workflow you are using is ok.

source/blender/editors/screen/area.c
232

I'm not sure I understand why you replace fdrawline with imm_draw_line_box?

source/blender/editors/screen/area.c
232

Good catch @Anthony Edlin (krash).

There is no replacement function for fdrawline, so expand these into

Begin(LINES, 4)
Vertex
Vertex
Vertex
Vertex
End

Fixed accidental conversion of lines into rects.

Punya Biswal (punya) marked 2 inline comments as done.Nov 18 2016, 4:20 PM

Thanks for catching the accidental rect conversion.

Mike Erwin (merwin) edited edge metadata.
This revision is now accepted and ready to land.Dec 13 2016, 8:48 PM

committed in blender2.8