GLSL Render To FBO with Multiple Texture Sources

Can any of you wizards supply me with some sample code that illustrates how to access more than one texture unit when rendering to texture with FBO? I’ve tried everything. I have no problem accessing multiple textures when I render to the screen, and I have no problem when using only one source texture.

When I render to the screen, I can access as many textures as I want just with samplers. I don’t need glMultiTexCoord calls in the drawing code. They just appear when I use the glGetUniform() calls. But this doesn’t work when drawing to FBO. I’ve tried the tutorial methods for multi-texture and they don’t work with FBO.

One area of confusion to me is the role of the vertex shader. I normally don’t use them. Could I be making a mistake in only using a fragment shader when multi-texturing.

I have seen other posts in the past asking about this same issue.

I appreciate any help.

Thanks,
Rennie

Seems I should have posted this on beginner forum. I’m starting a new post there.

Can any of you wizards supply me with some sample code that illustrates how to access more than one texture unit when rendering to texture with FBO? I’ve tried everything. I have no problem accessing multiple textures when I render to the screen, and I have no problem when using only one source texture.

Could you reformulate that and go directly to your issue? It is quite confusing and I really do not understand what you do not succeed to do.

AFAIK, there is no problem in not using a vertex shader when performing multitexturing.

When drawing to your FBO do you have any problems accessing each of the textures you wish to use individually without changing the units they are bound to?

No… FBO works as it supposed to work.
Can you explain more what are you trying to do? Any shaders involved? Are you trying to access textures as samplers or as render targets?
Post hw spec, driver versiom OS, etc…

You are all very kind. I will formulate a more detailed post with sample code next week and present a case that is not so ambiguous. Thanks for your responses, Rennie.

So, you’re rendering to TextureX. Your fragment-shader reads from TextureA and TextureB.

There must not be any problem. We do this all the time.

If you render to TextureB, while reading from TextureA and TextureB, problems are guaranteed.

Try providing a vertex-shader. It could be a driver-bug with this unlikely-to-use scenario that you have made.

Thanks for the hint Ilian.

In the vertex shader, do I need to do a Vertex Texture Fetch, or is it OK just to generate texture coordinates for the 2 or more source textures?

Would you have a simple example of Vertex Shader, Fragment shader and GL_QUAD/glMultiTexCoord drawing codes?

Also, when you do multitexture to an FBO with attached texture, do the source texture units have to begin with TEXTURE0 and ascend up to TEXTURE1 and TEXTURE2, or can you start at a higher texture number and skip numbers? My FBO render texture is TEXTURE0, and I’d like to source TEXTURE1 and skip some texture numbers for the 2nd and 3rd textures.

Thanks,
Rennie