Thank you , Klaus and mlb:)
About Fillrate bound: 1, Certainly I have used too many slices for my volume rendering.
My software is designed to reconstruct the human body through a sequence of medical image slices such as CT,MR . So I have no other choice:)
2, I use hardware accelerated 3d texture for volume rendering , instead of using raycasting.
I use a proxy geometry to manage view-aligned slices during my 3d texture mapping.
3. Viewport in my program is set like this: glViewport(0 , 0 , m_iWndWidth , m_iWndHeight);
in the above code snippet , m_iWndWidth is the window width which is about 500pixels, m_iWndHeight is the versus.
4.my fragment shader isn’t too complex, so at least it is to me:) I just do texture lookup ,then calculate phong light in the shader.
The gradients is pre-calculated by CPU during the data loading and preparing period. I even used a simplified fragment shader like this:
void main (void)
{
vec4 index = texture3D(my3DTexture , gl_TexCoord[0]);
gl_FragColor = index.z;
}
but to my disappointment, the frame rate remains slow.
About AGP/PCIe bound: I indeed have used glTexImage3d during the data loading and preparing period,but I don’t call them each frame.
glActiveTextureARB(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_3D,0);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
switch(iDataBits)
{
case 8:
glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE8, width, height, depth, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);
break;
case 32:
glTexImage3D(GL_TEXTURE_3D , 0 , GL_RGBA , width , height , depth , 0 , GL_RGBA , GL_UNSIGNED_BYTE , data);
break;
.....................................
but I still don’t know how does these codes harm the frame rate. Please tell me more in detail.
About Contex switch bound: There is no pBuffer in my current version.
About CPU bound: I just calcuate the proxy geometry according to new mouse position ,
then send uniform to shader and redraw the whole scene.