Browse Source

Shaders: fix port of *Vector shaders to old GLSL.

Texture layer binding was never set and there were various GLSL
compilation errors.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
261250f074
  1. 8
      src/Shaders/DistanceFieldVector.cpp
  2. 5
      src/Shaders/DistanceFieldVector.frag
  3. 4
      src/Shaders/Vector.cpp
  4. 5
      src/Shaders/Vector.frag

8
src/Shaders/DistanceFieldVector.cpp

@ -85,8 +85,16 @@ template<UnsignedInt dimensions> DistanceFieldVector<dimensions>::DistanceFieldV
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::shading_language_420pack>())
#endif
{
AbstractShaderProgram::setUniform(AbstractShaderProgram::uniformLocation("vectorTexture"),
AbstractVector<dimensions>::VectorTextureLayer);
}
/* Set defaults in OpenGL ES (for desktop they are set in shader code itself) */
#ifdef MAGNUM_TARGET_GLES
setOutlineRange(0.5f, 1.0f);
setSmoothness(0.04f);
#endif
}

5
src/Shaders/DistanceFieldVector.frag

@ -25,6 +25,7 @@
#ifndef NEW_GLSL
#define in varying
#define fragmentColor gl_FragColor
#define texture texture2D
#endif
#ifndef GL_ES
@ -52,10 +53,10 @@ layout(binding = 16) uniform sampler2D vectorTexture;
uniform lowp sampler2D vectorTexture;
#endif
in vec2 fragmentTextureCoordinates;
in mediump vec2 fragmentTextureCoordinates;
#ifdef NEW_GLSL
out vec4 fragmentColor;
out lowp vec4 fragmentColor;
#endif
void main() {

4
src/Shaders/Vector.cpp

@ -82,8 +82,10 @@ template<UnsignedInt dimensions> Vector<dimensions>::Vector(): transformationPro
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::shading_language_420pack>())
AbstractShaderProgram::setUniform(AbstractShaderProgram::uniformLocation("vectorTexture"), AbstractVector<dimensions>::VectorTextureLayer);
#endif
{
AbstractShaderProgram::setUniform(AbstractShaderProgram::uniformLocation("vectorTexture"), AbstractVector<dimensions>::VectorTextureLayer);
}
}
template class Vector<2>;

5
src/Shaders/Vector.frag

@ -25,6 +25,7 @@
#ifndef NEW_GLSL
#define in varying
#define fragmentColor gl_FragColor
#define texture texture2D
#endif
#ifdef EXPLICIT_UNIFORM_LOCATION
@ -39,10 +40,10 @@ layout(binding = 16) uniform sampler2D vectorTexture;
uniform lowp sampler2D vectorTexture;
#endif
in vec2 fragmentTextureCoordinates;
in mediump vec2 fragmentTextureCoordinates;
#ifdef NEW_GLSL
out vec4 fragmentColor;
out lowp vec4 fragmentColor;
#endif
void main() {

Loading…
Cancel
Save