X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=widgets.cpp;h=3bf53c77e428530dc5b731f33460077b35db2f27;hp=a17039118174d7d1f3d138009e54878abcad4f03;hb=9499a20d6c4c017ecfa96d0d32f5ee971ae93461;hpb=96a1cff51a8b7dc45ebe725e0d0685eecce31331 diff --git a/widgets.cpp b/widgets.cpp index a170391..3bf53c7 100644 --- a/widgets.cpp +++ b/widgets.cpp @@ -1,15 +1,15 @@ -#define GL_GLEXT_PROTOTYPES 1 - +#include #include -#include -#include #include "widgets.h" #include "util.h" -#include "texture_enum.h" #define HSV_WHEEL_SIZE 128 +namespace movit { + +GLuint hsv_wheel_num; + void draw_hsv_wheel(float y, float rad, float theta, float value) { glUseProgram(0); @@ -18,7 +18,7 @@ void draw_hsv_wheel(float y, float rad, float theta, float value) check_error(); glEnable(GL_TEXTURE_2D); check_error(); - glBindTexture(GL_TEXTURE_2D, HSV_WHEEL); + glBindTexture(GL_TEXTURE_2D, hsv_wheel_num); check_error(); glActiveTexture(GL_TEXTURE1); check_error(); @@ -110,6 +110,8 @@ void draw_saturation_bar(float y, float saturation) void make_hsv_wheel_texture() { + glGenTextures(1, &hsv_wheel_num); + static unsigned char hsv_pix[HSV_WHEEL_SIZE * HSV_WHEEL_SIZE * 4]; for (int y = 0; y < HSV_WHEEL_SIZE; ++y) { for (int x = 0; x < HSV_WHEEL_SIZE; ++x) { @@ -130,10 +132,9 @@ void make_hsv_wheel_texture() hsv_pix[(y * HSV_WHEEL_SIZE + x) * 4 + 3] = 255; } } - printf("\n"); } - glBindTexture(GL_TEXTURE_2D, HSV_WHEEL); + glBindTexture(GL_TEXTURE_2D, hsv_wheel_num); check_error(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); check_error(); @@ -156,3 +157,5 @@ void read_colorwheel(float xf, float yf, float *rad, float *theta, float *value) } } + +} // namespace movit