@WesHenrie wrote:
This is driving me a bit nuts but I cannot get a texture image to correctly pass into my shader. Everything else runs fine it just does not show the texture
Here is the call to the shader in my draw():
` img.bind();shader.begin(); shader.setUniform1f("u_time", ofGetElapsedTimef()); shader.setUniform2f("u_resolution", ofGetWidth(), ofGetHeight()); shader.setUniform2f("u_mouse", mouseX, mouseY); shader.setUniformTexture("u_text1", img.getTextureReference(), 1); ofRect(0,0, ofGetWindowWidth(), ofGetWindowHeight()); shader.end(); img.unbind();`
The bits I have in the setup() are:
` img.loadImage("rock.jpg");
// img.getTextureReference().bind();
ofDisableArbTex();
ofDisableAlphaBlending();And my shader header is:
`#ifdef GL_ES precision mediump float; #endif uniform vec2 u_resolution; uniform vec2 u_mouse; uniform float u_time; #define PI 3.14159265359 uniform sampler2D u_text1;`
The part where i call my texture is:
`vec3 texSample = texture2D( u_text1, newUv ).rgb; float uOff = ( texSample.g * brightness * 4.5 + time ); vec2 starUV = newUv + vec2( uOff, 0.0 ); starSphere = texture2D( u_text1, starUV ).rgb;`
The image texture just is not showing up it's very annoying and I can't figure out why. Is there something wrong in my code where i call the texture? I know that oF likes 2DRect however the image i'm using is 1024x1024 so figured regular 2d is appropriate here. If you want i can post the rest of my shader code, I built it off a shadertoy example
Posts: 1
Participants: 1