Unequally sized vectors dot product using FBO

The arb fbo relaxes the restriction faced by EXT fbo on the need of same dimension textures.

I have two 3D textures with same cross section dimension(i.e every sheet in both the 3D textures are of same dimensions ) but different depths (or number of sheets) …

I want to perform scalar product per sheet on both.
i.e components of Sheet1 and Sheet2 of Tex[0] should individually multiply to that of Sheet1 of Tex[1], using fragment shader, to get the dot product in component form.

To make it clear:
Lets say I have two vectors with 16 components each.
Then on CPU the dot product will be a single scalar value, but if shaders are employed, then
the dot product will be in vector form as intermediate result and then we sum them using reduction tech. to get final value

My action is to attach tex[0] and tex[1] to arb fbo and then do something like this


      glTexImage3D(.. ,.. ,.. , tex[0]);
      glTexImage3D(.. ,.. ,.. , tex[1]);

      setShader()

      //read back ..

setShader()
{
   //attach all sheets to attachment 0 at fbo
   for(i = 0 ; i < NumSheetsInTex0 ; i++)
   {
       glFramebufferTexture3DEXT(.., .. , ...tex[0],  0, i);
   }

   //attach all sheets to attachment 0 at fbo
   for(i = 0 ; i < NumSheetsInTex1 ; i++)
   {
       glFramebufferTexture3DEXT(.., .. , ...tex[1],  0, i);
   }

//  NumSheetsInTex1 <> NumSheetsInTex0

   drawSlice(W,H, <Depth>); 
}      

The drawSlice() is just like your drawQuad() but with Depth information. It basically draws a quad per sheet.

Q1. Now in drawSlice() , the third parameter is I am not sure what should be the value of Depth???

Or shall I pass
drawSlice(W,H,NumSheetsInTex0, NumSheetsInTex1); i.e both depth values (or number of sheets)

Q2. Then will drawSlice() be like this ???


{
   glMultiTexCoord0(0, 0, NumSheetsTex0);
   glMultiTexCoord0(0, 0, NumSheetsTex1);
   glVertex2f(0, 0); 

  and so on .... 
  
}

Now the main part.

Inside frag shader, for same texture sizes (2D or 3D) it is easy becuase the tex coord are same for both but in this case Q3. how will you access texels such that

all elements of sheet1 of Tex[0] are multiplied to all elements of sheet1 of Tex[1].

Then again all elements of sheet2 of Tex[0] get multiplied with all elements of sheet1 of Tex[1]

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.