Drawing 1 textured object and 1 un-textured object

I am looking at the Textured Box demo https://cvs.khronos.org/svn/repos/regis … itBox.html listed on http://khronos.org/webgl/wiki/Demo_Repository

I’d like to add a white square without texture to this demo so it will have 1 textured object (the original demo) and 1 object without texture.

The demo has the following code to texture the cube

<script id="fshader" type="x-shader/x-fragment">
#ifdef GL_ES
    precision mediump float;
#endif
        
    uniform sampler2D sampler2d;

    varying float v_Dot;
    varying vec2 v_texCoord;

    void main()
    {
        vec2 texCoord = vec2(v_texCoord.s, 1.0 - v_texCoord.t);
        vec4 color = texture2D(sampler2d, texCoord);
        color += vec4(0.1, 0.1, 0.1, 1);
        gl_FragColor = vec4(color.xyz * v_Dot, color.a);
    }
</script>

What do I need to do to draw the white square without texture?

Thanks in advance for your help.

I have just seen this article Passing a variable to a OpenGL GLSL shader http://stackoverflow.com/questions/2514 … le-in-glsl

I just pass a flag to the shader. It seems that it does what I want.

Please let me know if there is a better way.

<script id="fshader" type="x-shader/x-fragment">
#ifdef GL_ES
    precision mediump float;
#endif
    varying float v_Dot;

    void main()
    {
        gl_FragColor = vec4 ( vec3(1,1,1)*v_Dot, 1 ) ;
    }
</script>

The vec3(1,1,1) is the color of the object (in this case, white), multiplying it by v_Dot (which is, presumably, the lighting brightness from the vertex shader) applies lighting to the object, and the last ‘1’ sets the alpha to fully-opaque.