From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

OpenGL UI

Theme

Pass colors as uniforms?

  • 4 color settings (Outline, Item, Inner, Inner Selected) + Text Options: 5 settings (Text, Text Selected, Shaded, Shade Top, Shade Down) per option (Tool Tip, Menu Item, Scroll Bar, Progress Bar...) Total: 9 x 18 = 162
  • State: Blend factor + 6 colors
  • Styles: Menu Shadow Strength + Width, Icon Alpha, Widget Emboss. Total = 4
  • 3 Axis colors.

Other Themed things: Fonts, 3D View (grid, edges, vertex, lamp), Bone Groups..
Every Editor has a category, inside, the categories look opt-out shared: All have: Theme Space Settings (15 colors), Theme Panel Color (2 colors, 2 bools) Some have TSLS: Theme Space List Settings (4 colors)

  • Graph Editor: 24 colors, 2 int + TSLS
  • NLA Editor: 5 colors + TSLS
  • File Browser: 17 colors, 2 int + TSLS
  • Movie Clip: 25 colors, 2 int + TSLS
  • UV: 36 colors, 4 int
  • VSE: 19 colors, 1 int
  • Text: 11 colors
  • Nodes: 25 colors, 2 int
  • Timeline: 4 colors
  • Outliner: 2 colors
  • Info: 10 colors
  • Console: 6 colors
  • Logic, Properties, User Preferences


Drawing Fonts

  • get the font, size and dpi from the user preferences (x2: there is a font for the interface and another for monospace)
  • render and load the glyphs into a texture in GPU memory (per font)
  • ability to change the font according to: font files, internationalization language, dpi and text anti-aliasing
  • from the CPU: calculate horizontal and baseline offsets to render one line of text, set that as a uniform or buffer
  • have a quad per glyph, or generate these in a geometry shader. texture the quad in fragment using an overlay mode.

Good overview of modern OpenGL techniques to render text: http://stackoverflow.com/questions/5262951/what-is-state-of-the-art-for-text-rendering-in-opengl-as-of-version-4-1


Drawing Icons

  • Load Blender's custom icons to a texture in GPU
  • use them by ID

Transforms

2D zoom in/out + scroll