-
Notifications
You must be signed in to change notification settings - Fork 9
bgl_blf
October 2015
This topic is something people tend to gravitate towards once they've grasped the notions of Meshes: vertices, normals, indices, Vectors and Matrices - and the trigonometry and Linear Algebra used to perform calculations / transformations on them. This page will assume you are at that stage. Blender comes with many convenience functions to get you started.
Else there is further reading to accompany this if things aren't making sense.
2d text in the viewport is drawn using blf
see below.
This is a python wrapper around openGL drawing commands. openGL is a big topic, but once you understand the elementary concepts (which I intend to cover here) the learning curve for new openGL concepts gets less steep. It's possible to accomplish a lot without really knowing much about how openGL or the wrapper works.
You want to draw stuff. We could start with drawing 3d lines in the viewport with bgl, but Blender comes with a nice template to draw 2d lines. Let's start minimal.
TextEditor -> Templates -> Python -> 3dView Modal Draw
in Blender 2.80, bgl is modernized to use openGL 3+. In effect we lost "immediate mode", which means no more glBegin/End. On the other hand we get Vertex Buffer Objects and Fragment shaders. We also lose dashed lines (not a big deal for some..)
I'm experimenting in Sverchok for b28 with fragment shaders. Here some snippets fragment shader
Introduction
Objects / Mesh / BMesh
- Empty - null object
- Mesh
- Bmesh
- bmesh.ops - primitives
- bmesh.ops - mesh opsπ§
- Curves (2d, 3d)
- Text (Font Objects)
- Duplication (instancing)
- Metaballs
Time and Motion
- scripted keyframesπ
- Event Handlersπ
- Drivers
Miscellaneous bpy.data.*
Order / Organization
- Groupingπ
- Parentingπ
- Layers
- UI / Layoutπ
Miscellaneous
- Mathutilsπ
- Modifiersπ
- Particle Systemsπ
- vertex colorsπ
- Textures UV DPI
- Propertiesπ§
- Operators (and callbacks)π§
- bgl / blfπ
- Grease Pencil
- Themes
- Areas
Add-ons
- introductionπ
- import / exportπ
- Text Editorπ
- Custom Nodesπ