Page MenuHome

Blender 2.8: OpenGL: immediate mode for draw_text.c
AbandonedPublic

Authored by Benjamin Mizera (mizerb) on Dec 7 2016, 1:11 PM.

Details

Summary

Working in progress, wanted to get an idea of what to change. Running into issues where glcolor is set in another file through calls to UI_ThemeColor(). Trying to figure out if I should rewrite resources.c functions to make it work how I need , where the UI_Theme Color functions are, or add my own functions that work with the imm api.

Diff Detail

Repository
rB Blender

Event Timeline

Benjamin Mizera (mizerb) retitled this revision from to Blender 2.8: OpenGL: immediate mode for draw_text.c.
Benjamin Mizera (mizerb) updated this object.
Benjamin Mizera (mizerb) set the repository for this revision to rB Blender.
Benjamin Mizera (mizerb) updated this object.

We hit this problem before and created immUniformThemeColor functions. Look in GPU_immediate.h

Since the new functions set a uniform color, call them after you bind the shader/program but before immBegin.

This comment was removed by Benjamin Mizera (mizerb).

FYI you can set uniforms multiple times between Bind and Unbind.

Benjamin Mizera (mizerb) edited edge metadata.

The more set functions are good to go I think.
draw_cursor()
draw_brackets()
draw_textscroll()
draw_documentation()

Couple questions:
How should I be testing things, other than opening blender and poking things? Is there a set method, or something I can try to make sure I'm not breaking everything?

How worried should I be about all the times that UI_Theme color is called, to then have the actual gl drawing done in lower functions ( i.e. BLF_draw_mono() ). It looks like it pulls the color via glGetFloatv(GL_CURRENT_COLOR, temp_color) in blf.c . I'm trying (in my own google fueled manner) to figure out if this would still be valid if all the calls are swapped to immUniformThemeColor, and I guess I could figure it out if I knew what I was looking for with testing. Easier just to ask I suppose.

Changes relating to this patch have been added to 2.8 branch, closing.