Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

problem compiling shader on an X1950

I'm trying to compile the following shader on the gpu shader analyzer.

const int numTextures = 4;
uniform sampler2D textures[numTextures];
uniform vec2 texCoord;

void main()
    vec4 color = vec4(0.,0.,0.,1.);
    for(int i=0; i<numTextures; i++)

        vec4 colorTexture = texture2D(textures,texCoord);
        color = color * colorTexture;


    gl_FragColor = color;



This code is based on the one found in the Page 72 of the OpenGL shading language second edition book. This book is based on the OpenGL 2.0 especification that this graphics card supports.


The error the compiler gives me is the following:

"Compiler error: Sampler array indexes must be integral constant expressions"

Can any one tell me what I am doing wrong?? I've tested this same code on a couple of Nvidia cards I have lying around and they've compiled without problem.

0 Replies