PDA

View Full Version : rectangle textures and multitexturing ? (FBO inside)



divide
05-23-2005, 03:13 AM
Hello,

I'm obviously having a problem using a rectangular texture inside my multitexture system..

My multexture system was previously set as follows:


glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,Material->GLDiff);
glActiveTextureARB(GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,Material->GLDisp);
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,FBOTexture);Everything was working perfectly. I decided to transform my power-of-two FBOTexture into a rectangular texture and then.. nothing but black renders.


glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,Material->GLDiff);
glActiveTextureARB(GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,Material->GLDisp);
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_RECTANGLE_ARB);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB,FBOTexture) ;Actually, I'm not sure if my FBO (yes, you guess it, FBOTexture references to a texture drawn by a Frame Buffer Object) still draw something, or if the problem comes from the second pass (being unable to use both power-of-two and rectangular texture in a multitexturing system..). Of course, my FBOTexture was created appropriately with all the GL_TEXTURE_RECTANGLE_ARB required.

Any tips ?
If you have any code working with both FBO, rectangular texture and multitexturing (and why not, float texture datas), feel free to post it !

Relic
05-23-2005, 03:52 AM
Remembered that texture rectangles need unnormalized texture coordinates?
Using the same texture coordinates as before (0-1 range) will only fetch the bottom left texel.

If yes, add more FBO and GL error checks.

divide
05-23-2005, 04:07 AM
That's it !
I multiplied my texture coordinates by 200 (just to see) and saw my render !

God bless you, was fighting this **** for a month now ! ;)