Page MenuHome

blender 2.8: OpenGL immediate mode: editmesh_knife.c
AbandonedPublic

Authored by Luca Rood (LucaRood) on Jan 27 2017, 6:13 AM.

Details

Summary

Note that the KnifeColors struct was edited to include an alpha channel for all colors, to avoid having to call immBindBuiltinProgram multiple times to account for the different vertex formats.

Diff Detail

Repository
rB Blender

Event Timeline

Luca Rood (LucaRood) retitled this revision from to blender 2.8: OpenGL immediate mode: editmesh_knife.c.
Luca Rood (LucaRood) updated this object.
Luca Rood (LucaRood) set the repository for this revision to rB Blender.
source/blender/editors/mesh/editmesh_knife.c
1127

This immBeginAtMost and the one below, could be merged into a single immBegin if there was a shader that could draw square points and supported a size attribute, so that glPointSize wouldn't have to be used. But I haven't found such shader, and don't know how to make one... This could of course also just be left as is...

Will replace the immAttrib3ub calls with immUniformColor.

Note: if the immBeginAtMost calls are to be replaced with a single immBegin, like I commented about, this will have to keep using immAttrib3ub, as the color will change within a being/end.

Luca Rood (LucaRood) planned changes to this revision.Jan 28 2017, 3:22 PM
source/blender/editors/mesh/editmesh_knife.c
57

Do you still need BIF_gl.h?

1066–1068

Tip for FLAT shaders:
It's a little more efficient like this

immSkipAttrib(color);
immVertex3fv(pos, kcd->prev.cage);
immAttrib4ubv(color, kcd->colors.line);
immVertex3fv(pos, kcd->curr.cage);

Because only the provoking vertex of each primitive (2nd of each line, 3rd of each triangle) needs the flat attributes.

Will not really make a difference here but thought you would like to know!

1127

Why must they be square points? It's ok to make things look better.

1164

Good catch here! This did not need to be inside the loop.

Pushed to blender2.8

source/blender/editors/mesh/editmesh_knife.c
57

Yes, as long as the old matrix stuff is used. Gives type warning otherwise.

1066–1068

Noted, thanks for the tip :) (ended up using immUniformColor for everything here though...)

1127

Well... I ended up using UNIFORM_COLOR, and as the colors of these points change too, I would have to rebind this stuff, to define a vertex format with a color attribute in addition to the other size attribute... I think the way it is now is probably cheaper, so I just left it as is...