]> git.sesse.net Git - movit/blobdiff - widgets.cpp
In overlay matte, use the luminance as a matte instead of each individual color compo...
[movit] / widgets.cpp
index 529212fe10dbb5d0787c95f381596b36cd83b45a..09d878ed4fa065ce1fb112b9d405d16335c34d3d 100644 (file)
@@ -6,19 +6,20 @@
 
 #include "widgets.h"
 #include "util.h"
-#include "texture_enum.h"
 
 #define HSV_WHEEL_SIZE 128
 
+GLuint hsv_wheel_num;
+
 void draw_hsv_wheel(float y, float rad, float theta, float value)
 {
-       glUseProgramObjectARB(0);
+       glUseProgram(0);
        check_error();
        glActiveTexture(GL_TEXTURE0);
        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();
@@ -81,7 +82,7 @@ void draw_hsv_wheel(float y, float rad, float theta, float value)
 
 void draw_saturation_bar(float y, float saturation)
 {
-       glUseProgramObjectARB(0);
+       glUseProgram(0);
        check_error();
 
        // value slider
@@ -102,7 +103,7 @@ void draw_saturation_bar(float y, float saturation)
        glColor3f(0.0f, 0.0f, 0.0f);
        glPointSize(5.0f);
        glBegin(GL_POINTS);
-       glVertex2f(0.2f * (saturation / 4.0f) * 9.0f / 16.0f, y + 0.01f);
+       glVertex2f(0.2f * saturation * 9.0f / 16.0f, y + 0.01f);
        glEnd();
 
        glColor3f(1.0f, 1.0f, 1.0f);
@@ -110,6 +111,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) {
@@ -133,7 +136,7 @@ void make_hsv_wheel_texture()
                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();