specular1
11-05-2005, 05:59 AM
Hello,
I am wondering how you texture only certain parts of a scene. As a very simple example, I have as a fragment shader
uniform sampler2D texID;
void main(void)
{vec4 texColor = texture2D(texID,gl_TexCoord[0].st);
gl_FragColor = gl_Color * texColor;
}
In my code I have
glEnable(GL_TEXTURE_2D);
...
draw some stuff
...
glDisable(GL_TEXTURE_2D);
...
draw some more stuff
...
However, the entire scene is textured. Without binding an all white texture when I want parts of my scene to 'not be textured', how do I do this?
Are there glsl commands equivalent to glIsEnabled so that I could branch as needed
...
if (glIsEnabled(GL_TEXTURE_2D)){
gl_FragColor = gl_Color * texColor;
}else{
gl_FragColor = gl_Color;
}
...
Or is there some other preferred way?
Any help is appreciated. Thank-you.
I am wondering how you texture only certain parts of a scene. As a very simple example, I have as a fragment shader
uniform sampler2D texID;
void main(void)
{vec4 texColor = texture2D(texID,gl_TexCoord[0].st);
gl_FragColor = gl_Color * texColor;
}
In my code I have
glEnable(GL_TEXTURE_2D);
...
draw some stuff
...
glDisable(GL_TEXTURE_2D);
...
draw some more stuff
...
However, the entire scene is textured. Without binding an all white texture when I want parts of my scene to 'not be textured', how do I do this?
Are there glsl commands equivalent to glIsEnabled so that I could branch as needed
...
if (glIsEnabled(GL_TEXTURE_2D)){
gl_FragColor = gl_Color * texColor;
}else{
gl_FragColor = gl_Color;
}
...
Or is there some other preferred way?
Any help is appreciated. Thank-you.