CC=@CC@
CXX=@CXX@
-CXXFLAGS=-Wall @CXXFLAGS@ -I$(GTEST_DIR)/include @Eigen3_CFLAGS@ @GLEW_CFLAGS@
-LDFLAGS=@GLEW_LIBS@ @SDL_LIBS@ -lpthread
+CXXFLAGS=-Wall @CXXFLAGS@ -I$(GTEST_DIR)/include @Eigen3_CFLAGS@ @epoxy_CFLAGS@
+LDFLAGS=@epoxy_LIBS@ @SDL_LIBS@ -lpthread
DEMO_LDLIBS=@SDL_image_LIBS@ -lrt -lpthread @libpng_LIBS@
SHELL=@SHELL@
LIBTOOL=@LIBTOOL@ --tag=CXX
works fine on Linux and OS X, and Movit is not very POSIX-bound.)
* GNU Make.
* A GPU capable of running GLSL fragment shaders,
- process floating-point textures, and a few other things. If your machine
- is less than five years old _and you have the appropriate drivers_,
- you're home free.
+ processing floating-point textures, and a few other things (all are
+ part of OpenGL 3.0 or newer, although most OpenGL 2.0 cards also
+ have what's needed through extensions). If your machine is less than five
+ years old _and you have the appropriate drivers_, you're home free.
* The [Eigen 3] and [Google Test] libraries. (The library itself
depends only on the former, but you probably want to run the unit tests.)
-* The [GLEW] library, for dealing with OpenGL extensions on various
+* The [epoxy] library, for dealing with OpenGL extensions on various
platforms.
Movit has been tested with Intel GPUs with the Mesa drivers
TL;DR, but I am interested in a programming example instead
===========================================================
-Assuming you have an OpenGL context already set up:
+Assuming you have an OpenGL context already set up (currently you need
+a classic OpenGL context; a GL 3.2+ core context won't do):
<code>
using namespace movit;
// Unit tests for AlphaDivisionEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "gtest/gtest.h"
#include "image_format.h"
#include "test_util.h"
// Unit tests for AlphaMultiplicationEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "effect_chain.h"
#include "gtest/gtest.h"
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <math.h>
#include <algorithm>
// which is what the user is intended to use, instantiates two copies of
// SingleBlurPassEffect behind the scenes).
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <stddef.h>
#include <string>
// Unit tests for BlurEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include <string.h>
// Unit tests for ColorspaceConversionEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "colorspace_conversion_effect.h"
#include "gtest/gtest.h"
AC_PROG_CC
AC_PROG_CXX
PKG_CHECK_MODULES([Eigen3], [eigen3])
-PKG_CHECK_MODULES([GLEW], [glew])
+PKG_CHECK_MODULES([epoxy], [epoxy])
# Needed for unit tests and the demo app.
PKG_CHECK_MODULES([SDL], [sdl])
#include <Eigen/Dense>
#include <Eigen/Cholesky>
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <math.h>
#include <stdio.h>
//
// Jain, Anil K.: “Fundamentals of Digital Image Processing”, Prentice Hall, 1988.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <Eigen/Dense>
#include <string>
// Unit tests for DeconvolutionSharpenEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include <stdlib.h>
#define WIDTH 1280
#define HEIGHT 720
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <SDL/SDL.h>
#include <SDL/SDL_error.h>
#include <SDL/SDL_events.h>
// where we first blur the picture, and then overlay it on the original
// using the original as a matte.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <string>
// Unit tests for DiffusionEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "diffusion_effect.h"
#include "effect_chain.h"
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <stdio.h>
#include <algorithm>
// like many LCD monitors do, but it starts to get very hairy, again, for limited gains.)
// The dither is also deterministic across runs.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <string>
#include "effect.h"
// Unit tests for DitherEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include "effect_chain.h"
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
// effect instance; use the macro PREFIX() around your identifiers to
// automatically prepend that prefix.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <stddef.h>
#include <map>
#define GL_GLEXT_PROTOTYPES 1
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <locale.h>
#include <math.h>
// the EffectChain holds textures and other OpenGL objects that are tied to the
// context.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <stdio.h>
#include <map>
#include <set>
//
// Note that this also contains the tests for some of the simpler effects.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include "effect.h"
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <Eigen/Core>
#include <stddef.h>
#include <string>
// Utilities that are often useful for implementing Effect instances,
// but don't need to be included from effect.h.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <stddef.h>
#include <Eigen/Core>
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include "effect_util.h"
// scaling), and as fp16 has quite limited range at times, this can be relevant
// on some GPUs for larger sizes.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <stdio.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include <epoxy/gl.h>
+#include <gtest/gtest.h>
#include "effect_chain.h"
#include "fft_pass_effect.h"
-#include "glew.h"
-#include "gtest/gtest.h"
#include "image_format.h"
#include "multiply_effect.h"
#include "test_util.h"
#include <string.h>
#include <assert.h>
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "effect_util.h"
#include "flat_input.h"
#ifndef _MOVIT_FLAT_INPUT_H
#define _MOVIT_FLAT_INPUT_H 1
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <string>
// Unit tests for FlatInput.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <stddef.h>
#include "effect_chain.h"
// Note that Movit's internal formats generally do not have enough accuracy
// for 12-bit input or output.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <string>
#include "effect.h"
// However, the accuracy tests are somewhat simpler, since we
// only need to care about absolute errors and not relative.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include "gtest/gtest.h"
// Note that Movit's internal formats generally do not have enough accuracy
// for 12-bit input or output.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <string>
#include "effect.h"
// Unit tests for GammaExpansionEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include "gamma_expansion_effect.h"
// Glow: Cut out the highlights of the image (everything above a certain threshold),
// blur them, and overlay them onto the original image.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <string>
// Unit tests for GlowEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include "effect_chain.h"
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <stddef.h>
#include <algorithm>
bool check_extensions()
{
// We fundamentally need FBOs and floating-point textures.
- if (!glewIsSupported("GL_ARB_framebuffer_object")) return false;
- if (!glewIsSupported("GL_ARB_texture_float")) return false;
+ // FBOs are covered by OpenGL 1.5, and are not an extension there.
+ // Floating-point textures are part of OpenGL 3.0 and newer.
+ if (epoxy_gl_version() < 15 &&
+ !epoxy_has_gl_extension("GL_ARB_framebuffer_object")) return false;
+ if (epoxy_gl_version() < 30 &&
+ !epoxy_has_gl_extension("GL_ARB_texture_float")) return false;
// We assume that we can use non-power-of-two textures without restrictions.
- if (!glewIsSupported("GL_ARB_texture_non_power_of_two")) return false;
+ if (epoxy_gl_version() < 20 &&
+ !epoxy_has_gl_extension("GL_ARB_texture_non_power_of_two")) return false;
// We also need GLSL fragment shaders.
- if (!glewIsSupported("GL_ARB_fragment_shader")) return false;
- if (!glewIsSupported("GL_ARB_shading_language_100")) return false;
+ if (epoxy_gl_version() < 20) {
+ if (!epoxy_has_gl_extension("GL_ARB_fragment_shader")) return false;
+ if (!epoxy_has_gl_extension("GL_ARB_shading_language_100")) return false;
+ }
// FlatInput and YCbCrInput uses PBOs. (They could in theory do without,
// but no modern card would really not provide it.)
- if (!glewIsSupported("GL_ARB_pixel_buffer_object")) return false;
+ if (epoxy_gl_version() < 21 &&
+ !epoxy_has_gl_extension("GL_ARB_pixel_buffer_object")) return false;
// ResampleEffect uses RG textures to encode a two-component LUT.
- if (!glewIsSupported("GL_ARB_texture_rg")) return false;
+ if (epoxy_gl_version() < 30 &&
+ !epoxy_has_gl_extension("GL_ARB_texture_rg")) return false;
// sRGB texture decode would be nice, but are not mandatory
// (GammaExpansionEffect can do the same thing if needed).
- movit_srgb_textures_supported = glewIsSupported("GL_EXT_texture_sRGB");
+ movit_srgb_textures_supported =
+ (epoxy_gl_version() >= 21 || epoxy_has_gl_extension("GL_EXT_texture_sRGB"));
// We may want to use round() at the end of the final shader,
// if supported. We need either GLSL 1.30 or this extension to do that,
// and 1.30 brings with it other things that we don't want to demand
// for now.
- movit_shader_rounding_supported = glewIsSupported("GL_EXT_gpu_shader4");
+ movit_shader_rounding_supported =
+ (epoxy_gl_version() >= 30 || epoxy_has_gl_extension("GL_EXT_gpu_shader4"));
return true;
}
movit_data_directory = new string(data_directory);
movit_debug_level = debug_level;
- GLenum err = glewInit();
- if (err != GLEW_OK) {
- return false;
- }
-
// geez
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include "effect_util.h"
// Also, gamma is a case where we would not want premultiplied alpha.
// Thus, we have to divide away alpha first, and then re-multiply it back later.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <string>
#include "effect.h"
// Unit tests for LiftGammaGainEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "effect_chain.h"
#include "gtest/gtest.h"
// Unit tests for MixEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "effect_chain.h"
#include "gtest/gtest.h"
Version: git
Requires:
Conflicts:
-Libs: -lmovit @GLEW_LIBS@
-Cflags: -I${includedir}/movit @Eigen3_CFLAGS@ @GLEW_CFLAGS@
+Libs: -lmovit @epoxy_LIBS@
+Cflags: -I${includedir}/movit @Eigen3_CFLAGS@ @epoxy_CFLAGS@
// sending it through OverlayEffect, e.g. with R=G=B=A=0.3 to get 30% alpha
// (remember, alpha is premultiplied).
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <string>
#include "effect.h"
// Unit tests for OverlayEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "effect_chain.h"
#include "gtest/gtest.h"
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include "effect_util.h"
// You may not change it after calling finalize(), since that could change the
// graph (need_linear_light() etc. depend on the border color you choose).
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <string>
#include "effect.h"
// Unit tests for AlphaMultiplicationEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <stddef.h>
#include "effect_chain.h"
// Three-lobed Lanczos, the most common choice.
#define LANCZOS_RADIUS 3.0
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <limits.h>
#include <math.h>
// which is what the user is intended to use, instantiates two copies of
// SingleResamplePassEffect behind the scenes).
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <stddef.h>
#include <string>
// Unit tests for ResampleEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
+#include <gtest/gtest.h>
#include <math.h>
#include "effect_chain.h"
#include "flat_input.h"
-#include "glew.h"
-#include "gtest/gtest.h"
#include "image_format.h"
#include "resample_effect.h"
#include "test_util.h"
#include <map>
#include <string>
#include <utility>
+#include <epoxy/gl.h>
-#include "glew.h"
#include "init.h"
#include "resource_pool.h"
#include "util.h"
// safely called from multiple threads at the same time, provided they have
// separate (but sharing) OpenGL contexts.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <pthread.h>
#include <stddef.h>
#include <list>
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "sandbox_effect.h"
#include "util.h"
// throwaway code. When you're happy, you can do a bit of search and replace
// to give it a proper name and its own place in the build system.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <string>
#include "effect.h"
// Unit tests for SaturationEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "effect_chain.h"
#include "gtest/gtest.h"
#include <math.h>
#include <stdio.h>
#include <algorithm>
+#include <epoxy/gl.h>
+#include <gtest/gtest.h>
+#include <gtest/gtest-message.h>
#include "flat_input.h"
-#include "glew.h"
-#include "gtest/gtest.h"
-#include "gtest/gtest-message.h"
#include "init.h"
#include "resource_pool.h"
#include "test_util.h"
#ifndef _MOVIT_TEST_UTIL_H
#define _MOVIT_TEST_UTIL_H 1
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "effect_chain.h"
#include "image_format.h"
// See DeconvolutionSharpenEffect for a different, possibly better
// sharpening algorithm.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <string>
// Unit tests for UnsharpMaskEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include "effect_chain.h"
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <math.h>
#include <stdio.h>
// Various utilities.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <stdio.h>
#include <stdlib.h>
#include <Eigen/Core>
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <math.h>
// A circular vignette, falling off as cos² of the distance from the center
// (the classic formula for approximating a real lens).
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <string>
#include "effect.h"
// Unit tests for VignetteEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include "effect_chain.h"
#include <Eigen/Core>
#include <Eigen/LU>
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include "colorspace_conversion_effect.h"
// Color correction in LMS color space.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <string>
#include "effect.h"
// Unit tests for WhiteBalanceEffect.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include "effect_chain.h"
#include "gtest/gtest.h"
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <math.h>
#include "widgets.h"
#include <Eigen/Core>
#include <Eigen/LU>
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
// imprecisely, called “YUV”), which is typically what you get from a video decoder.
// It upsamples planes as needed, using the default linear upsampling OpenGL gives you.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include <string>
// Unit tests for YCbCrInput.
// FIXME: This class really ought to support mipmaps.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <stddef.h>
#include "effect_chain.h"