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
This commit is contained in:
2016-08-20 15:40:08 -04:00
parent eb717ee979
commit be2bc7e0f6
3 changed files with 63 additions and 17 deletions

View File

@@ -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;