View Full Version : About Enabling and Disabling texture in Fragment Program?

09-15-2003, 05:47 AM
I have a geomtry scene that some nodes have texture and others have not. What is confusing me is How to deal with this case in one fragment program?

I mean, If I use texture with some nodes, but when rendering other nodes without texture, what value will I get?

I think I can solve it by sorting the nodes in terms of texture. When I render the nodes with texture, I use one FP, And I render the nodes without texture ,I use another FP. Have any other Method to solve it?

09-15-2003, 06:00 AM
you can pass an argument to your FP to switch between different path within the FP, but sorting your geometry and loading a different FP is BY FAR the most efficient way to deal with your "problem"...


09-16-2003, 12:55 AM
We have currently 58 fragment programs, and still counting ...


09-17-2003, 12:06 AM
Originally posted by zhq424:
Have any other Method to solve it?

Maybe you could set up a small(2x2) "empty" texture and use that as the texture for the nodes that don't have a real texture bound to it. The definition of empty depends on what you do with the result. Addition=use black, modulation=use white. Just a thought.

09-19-2003, 12:55 PM
glBindTexture(0) will enable a white texture.
It should work with your fragment program ...