PDA

View Full Version : texture2D aborting my fragment?



pete275
07-17-2010, 11:43 PM
Hi.. I have this fragment program:



varying vec2 uv_interp;
varying vec4 color;


#ifdef USE_TEXTURE_DIFFUSE
uniform sampler2D diffuse_texture;
#endif

void main() {

#ifdef USE_TEXTURE_DIFFUSE
vec4 diffuse = texture2D(diffuse_texture, uv_interp);
#else
vec4 diffuse = color;
#endif

gl_FragColor = diffuse;
}


the problem is that when I use a texture, no pixels appear on the screen when I call texture2D, even if I overwrite the alpha to 1.0 (in fact, even if I overwrite 3 of the components of 'diffuse', as long as the call to texture2D remain used, no pixels show up). If I don't call texture2D and just set an arbitrary color, or form one using uv_interp for example, it draws just fine.

What could be causing the fragment program to abort completely when texture2D is called? I get no errors from glGetError, I tried using 'isnan' to check the values from texture2D, and nothing..

thanks.