#include "saturation_effect.h"
#include "mirror_effect.h"
#include "vignette_effect.h"
-#include "texture_enum.h"
EffectChain::EffectChain(unsigned width, unsigned height)
: width(width), height(height), use_srgb_texture_format(false), finalized(false) {}
memset(mapped_pbo, 0, width * height * bytes_per_pixel);
glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB);
- glBindTexture(GL_TEXTURE_2D, SOURCE_IMAGE);
+ glGenTextures(1, &source_image_num);
+ check_error();
+ glBindTexture(GL_TEXTURE_2D, source_image_num);
+ check_error();
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
check_error();
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));
check_error();
// Re-upload the texture from the PBO.
glActiveTexture(GL_TEXTURE0);
check_error();
- glBindTexture(GL_TEXTURE_2D, SOURCE_IMAGE);
+ glBindTexture(GL_TEXTURE_2D, source_image_num);
check_error();
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, format, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));
check_error();
ImageFormat input_format, output_format;
std::vector<Effect *> effects;
+ GLuint source_image_num;
bool use_srgb_texture_format;
GLint glsl_program_num;
#include "effect_chain.h"
#include "util.h"
#include "widgets.h"
-#include "texture_enum.h"
unsigned char result[WIDTH * HEIGHT * 4];
float radius = 0.3f;
float inner_radius = 0.3f;
-
+
void update_hsv(Effect *lift_gamma_gain_effect, Effect *saturation_effect)
{
RGBTriplet lift(0.0f, 0.0f, 0.0f);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glBindTexture(GL_TEXTURE_2D, SOURCE_IMAGE);
- check_error();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- check_error();
-
unsigned img_w, img_h;
unsigned char *src_img = load_image("blg_wheels_woman_1.jpg", &img_w, &img_h);
+++ /dev/null
-#ifndef _TEXTURE_ENUM_H
-#define _TEXTURE_ENUM_H 1
-
-enum textures {
- SOURCE_IMAGE = 1,
- SRGB_LUT = 2,
- SRGB_REVERSE_LUT = 3,
- HSV_WHEEL = 4,
-};
-
-#endif // !defined(_TEXTURE_ENUM_H)
-
#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)
{
glUseProgram(0);
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();
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) {
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();