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.
Details
- Reviewers
Mike Erwin (merwin) - Maniphest Tasks
- T49043: replace OpenGL immediate mode in Blender 2.8
- Commits
- rBS13399d471e5a: OpenGL immediate mode: editmesh_knife.c
Diff Detail
- Repository
- rB Blender
Event Timeline
| 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.
| source/blender/editors/mesh/editmesh_knife.c | ||
|---|---|---|
| 57 | Do you still need BIF_gl.h? | |
| 1066–1068 | Tip for FLAT shaders: 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... | |