autom texture coord gen and cg


I want to map 2 textures simultaniously on a plane, by use of autom texture coord gen, and apply a function, written in cg, while rendering these textures. It seems that only texture buffer GL_TEXTURE0 is able to render with the autom texture gen; if I specify another texture buffer, then no texture is rendered. So I can only render the textures one after the other, and seem not to be able to apply the cg function on them without rerendering both results of the framebuffer with specifying glMultiTexCoord2f.
Is there a way to apply a cg function on 2 textures without rendering them with glMultiTexCoord2f, but with use of autom texture generation? How can I get autom texture generation work with other texture buffers as GL_TEXTURE0

If you are using a vertex program, you’ll need to write your own texture coordinate generation.

You can find example replacement Cg code for the various OpenGL texgen modes in this document:

You can specify automatic texture coordinate generation for the fixed-function pipeline for any texture unit. Just activate the right texture unit before specifying the TexEnv.

However, if you use CG, then that’s likely to subsume the fixed function pipeline, and you have to generate texture coordinates yourself (typically using DP4 with the vertex position and your plane equations).