Page MenuHome

blender 2.8: OpenGL immediate mode: drawanimviz.c
AbandonedPublic

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

Details

Summary

Added a UI_GetThemeColorBlendShade3ubv function to resources.c, as that was necessary for this conversion.

Also, note that the old code in this file was mixing 3ub colors and 3f colors, so I decided to stick to 3ub, and convert the floats, but if for some reason it is deemed to be better to use 3f instead, I can change that...

Diff Detail

Repository
rB Blender

Event Timeline

Luca Rood (LucaRood) retitled this revision from to blender 2.8: OpenGL immediate mode: drawanimviz.c.
Luca Rood (LucaRood) updated this object.
Luca Rood (LucaRood) set the repository for this revision to rB Blender.

See comments. Also, please remember for the final commit to split this in two commits, one for the new util function, and one using it.

I'm not with the code opened here, so some of my comments may be just wrong, based on my poor memory of the API implementation.

source/blender/editors/space_view3d/drawanimviz.c
280

Is that working? I would expect immAttrib to need to be called for each vertex.

That said I think the drawing happens after immEnd(), so it should be fine to use UNIFORM_COLOR and instead of attribute pass the color as uniform, no?

source/blender/editors/space_view3d/drawanimviz.c
280

Yes, it works. From the wiki: "If you skip some attributes of a vertex, they will be carried over from the previous vertex."

Still, UNIFORM_COLOR would be better, but can I call immUniformColor multiple times to change color within a single bind/unbind?

Tobias Mertz (TCMBoby) added inline comments.
source/blender/editors/space_view3d/drawanimviz.c
280

Yes, you can set UNIFORM_COLOR multiple times within a single bind/unbind. Just not within immBegin/immEnd blocks.

Luca Rood (LucaRood) planned changes to this revision.Jan 28 2017, 3:14 PM

Will replace the immAttrib3ub calls with immUniformColor.

source/blender/editors/space_view3d/drawanimviz.c
278

Oh, forgot to mention before... I removed the note about these points being barely visible, because they only weren't visible because they weren't actually black, but were rather just using the color from the last color call...

I'm sure that was unintended behavior, so I have now set them explicitly to black, and now they are quite visible.

280

Ah, awesome, that makes sense :)
I'll change this here (and probably in other files too).

Looks good so far, expecting your planned changes to be good also.

source/blender/editors/space_view3d/drawanimviz.c
52

Still need BIF_gl.h?

278

Niiiice!

Pushed to blender2.8

source/blender/editors/space_view3d/drawanimviz.c
52

Yes, as long as the old matrix stuff is used...