diff options
author | Mike Erwin <significant.bit@gmail.com> | 2016-08-20 22:40:08 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2016-08-20 22:40:08 +0300 |
commit | be2bc7e0f66b9ed1c863790b3555aa3e7db4cb76 (patch) | |
tree | 6662e4f1aea3e627d1c0cc3a5e2621229063a094 /source/blender/editors/screen/glutil.c | |
parent | eb717ee9794a0e3c217f7e6f32904a115fc6e9e1 (diff) |
OpenGL: draw color picker wheel with new immediate mode
Includes new imm_draw_lined_circle function that can be used for other
widgets.
Part of T49043
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index b99927cea41..3ed89ed8a07 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -49,6 +49,7 @@ #include "IMB_imbuf_types.h" #include "GPU_basic_shader.h" +#include "GPU_immediate.h" #include "UI_interface.h" @@ -181,6 +182,17 @@ void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments glEnd(); } +void imm_draw_lined_circle(unsigned pos, float x, float y, float rad, int nsegments) +{ + immBegin(GL_LINE_LOOP, nsegments); + for (int i = 0; i < nsegments; ++i) { + float angle = 2 * M_PI * ((float)i / (float)nsegments); + immVertex2f(pos, x + rad * cosf(angle), + y + rad * sinf(angle)); + } + immEnd(); +} + float glaGetOneFloat(int param) { GLfloat v; |