Page MenuHome

Use new immediate mode for ED_region_grid_draw
ClosedPublic

Authored by Anthony Edlin (krash) on Oct 12 2016, 7:57 AM.

Diff Detail

Repository
rB Blender

Event Timeline

Anthony Edlin (krash) retitled this revision from to Use new immediate mode for ED_region_grid_draw.
Anthony Edlin (krash) updated this object.
Anthony Edlin (krash) set the repository for this revision to rB Blender.

This is one of four different grid drawing functions in blender. The others are in view2d.c. This one is used for UV/image editor and clip editor when there is no image or clip.

This is the last of the glBegin calls in area.c, but there remains a few glRect, fdrawline, and fdrawbox calls though.

Good so far, comments below.

What do you think we should do about fdrawline, fdrawbox, etc? Could provide more immHelper functions, but do we really need help drawing a single line?

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

We're using C99, so declare these closer to where they are used. See below.

2388

immRectf is now ready!

Use GPU_SHADER_2D_UNIFORM_COLOR and immUniformColor3fv(theme_color) before calling immRectf.

2420
float count_fine = ...
float count_large = ...

Why floats anyway? Floats are for measuring, integers are for counting.

2423

style: add space between if and (

2424

Since the UNIFORM_COLOR shader does not have a color attribute you'll have to reset the vertex format and add "pos" & "color". How to reset:

VertexFormat_clear(format);

This might be an opportunity to talk about VertexFormat API improvements.

2432
for (int i = ...

It does seem silly to add helper functions to just draw a line. Plus I don't think it works that well with gawain as it is, having to pass in attribs and do all the setup outside the function anyways, what's the point in helper function then really.

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

Not sure I understand what you mean, they are ints aren't they? I can move declaration to there if it makes more sense.

Anthony Edlin (krash) edited edge metadata.

Made most suggested changes, also used new immUniformThemeColorShade.

Anthony Edlin (krash) marked 6 inline comments as done.Oct 13 2016, 9:15 AM

Any update on this? It's been a little while and I want to finalize this either open or closed.

Thanks.

Mike Erwin (merwin) edited edge metadata.

Tested good with Image/UV editor. Sorry for taking so long!

This revision is now accepted and ready to land.Nov 16 2016, 12:33 AM

Landed in blender2.8