Skip to content

Instantly share code, notes, and snippets.

@elliotwoods
Created January 12, 2016 06:56
Show Gist options
  • Save elliotwoods/c36724b7f8b90a7abd1a to your computer and use it in GitHub Desktop.
Save elliotwoods/c36724b7f8b90a7abd1a to your computer and use it in GitHub Desktop.
#version 150
uniform sampler2DRect tex0;
in vec2 texCoordVarying;
out vec4 outputColor;
uniform float minimum;
uniform float maximum;
void main() {
vec4 inputColor = texture2DRect(tex0, texCoordVarying);
outputColor = (inputColor - minimum) / (maximum - minimum);
}
#version 150
// these are for the programmable pipeline system and are passed in
// by default from OpenFrameworks
uniform mat4 modelViewProjectionMatrix;
in vec4 position;
in vec2 texcoord;
// this is something we're creating for this shader
out vec2 texCoordVarying;
void main()
{
// here we move the texture coordinates
texCoordVarying = texcoord;
// send the vertices to the fragment shader
gl_Position = modelViewProjectionMatrix * position;
}
shader.begin();
shader.setUniform1f("minimum", this->style.rangeMinimum);
shader.setUniform1f("maximum", this->style.rangeMaximum);
this->texture.draw(0, 0, width, height);
shader.end();
@elliotwoods
Copy link
Author

access violation if ofShader.cpp:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment