Mark Davey (mkd@medphys.ucl.ac.uk)
Thu, 02 Mar 2000 14:16:01 -0800
As an example I am including a revised Draw function to replace that
found in voglMain.cxx
If the demo program
voglBasic CT.Head.Small.char.tif -sc 1 1 3.2
is then run on our Onyx2 then I get a nice fog enhanced volume rendered
image. If however I run the same code on the Octane then I simply get a
black screen. Am I defining my fog incorrectly? Or is there some problem
with the Octane? Or is Volumizer doing something strange if fog is
enabled (seems unlikely)
Anyway here is the code segment. I replace the usual glFrustum command
with one of my own to help me set the fog up correctly.
Regards
Mark
void
Draw(Widget widget)
{
glEnable(GL_DEPTH_TEST);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
float m[4][4];
build_rotmatrix(m, cumulativeQuaternion);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Temporary changes to show fog
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(
-0.0025, 0.0025, -0.0025, 0.0025, 0.01, my_Data.modelSize[2]*4);
glMatrixMode(GL_MODELVIEW);
glTranslatef(0, 0, -my_Data.modelSize[2]*3);
glEnable(GL_FOG);
GLfloat fogColor[4] = {0.0,0.0,0.0,0.0};
glFogi(GL_FOG_MODE,GL_LINEAR);
glFogfv(GL_FOG_COLOR,fogColor);
glFogf(GL_FOG_DENSITY,0.01);
glFogf(GL_FOG_START,my_Data.modelSize[2]*2.0);
glFogf(GL_FOG_END,my_Data.modelSize[2]*3);
// End of changes
glMultMatrixf(&(m[0][0]));
glRotatef(180, 0, 1, 0); // initial rotations
glRotatef( 90, 1, 0, 0); // initial rotations
glScalef(
my_Data.modelScale[0], my_Data.modelScale[1],
my_Data.modelScale[2]);
glTranslatef(
-my_Data.modelCentroid[0],
-my_Data.modelCentroid[1],
-my_Data.modelCentroid[2]);
my_DrawVolume(my_Data.aTetraSet, my_Data.aVolume);
GLwDrawingAreaSwapBuffers(widget);
}
-- From: Mark Davey Dept. of Medical Physics, UCL.TEL: +44 (0)171 915 1673. FAX: +44 (0)171 837 9279.
Institute of Laryngology and Otology, 330 Gray's Inn Road, London. WC1X 8GE.
This archive was generated by hypermail 2.0b2 on Thu Mar 02 2000 - 06:28:56 PST