I’m creating a application that basically can use 6 textures to compute a fragcolor in the fragment program.
Problem is that this application also needs to work on video cards with 4 texture units.
So my idea is to use multi pass rendering.
I draw a polygon witht the 1st 3 textures enabled. and then draw again with the other 3. The final color is a combination of all 6 textures.
1st color algorithm:
From the maintexture, using look up texture gives new Frag value (apply a display filter).
This new Frag value is used to look into a colorset texture to get the correct color ( apply colorset texture).
I got the above working.
But now I want to overlay this maintexture (using mix()) with another texture created exactly like the above. Should I be using FBO’s?
Am I explaining my problem correct? If so do any of you know how to do this?
If you need more information I will post.
The thing is actually very weard and I haven’t all the answer to it.
For a look time now graphics card have more that 4 texture units… but glGetIntegerv(GL_MAX_TEXTURE_UNIT, ); return 4 on my GeForce 8800… however I successfully bind more that 4 textures.
If someone have clues on this I will appreciate but anyway in your case, just bind 6 textures, it works!
Use GL_MAX_TEXTURE_UNITS to get the number of (fixed-function) texture units. Min is 2. Max is 32. It is 4 on my nVidia Quadro FX 3600M
Use GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS to get the number of texture image units accessible by a vertex shader. Min is 0. 32 for me.
Use GL_MAX_TEXTURE_IMAGE_UNITS to get the number of texture image units accessible by fragment processing. Min is 2. 32 for me.
Use GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS to get the total number of texture units accessible by the GL. Min is 2. 32 for me.
Under Linux, just type glxinfo -l
But what’s this GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS? Oo When does it apply?
Well thanks that solved my trouble.
Still dont know how to do multipass shading. But I dont need to do it anymore.
Ran into new problem :o
I’m binding a texture to my 5th texture unit see code below.
I draw this texture no problemo.
int unit = 4;
glActiveTextureARB(GL_TEXTURE0_ARB + unit);
But when I try to access this texture in my fragment shader by calling
colorOverlay = texture2D(textureOverlay, vec2(gl_TexCoord.st))
I get only black back. Even when I change the gl_TexCoord to gl_TexCoord.
Do I forget something?
Omg I’m stupid
When I actived my texture I had the old check on max texture units. Basically returning when its more then GL_MAX_TEXTURE_UNITS.
Well you understand … :o
All solved now!
Regards & Thanks,
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.