[minor bug] minor bug has in the Z buffered trihedron

In the function call_zbuffer_triedron_redraw of TKOpengl, the z buffered trihedron changes colors in case there is an object in the scene that has an explicit material attached to it.In the trihedron display loop, GL_COLOR_MATERIAL is enabled, but only the GL_DIFFUSE parameter is utilized in glColorMaterial(...).This causes the last ambient,specular and emission values used, to stay at the stack and applied to the trihedron(which causes the color change).A fix is proposed , to change GL_DIFFUSE to GL_AMBIENT_AND_DIFFUSE in glColorMaterial call in line 946.The above of course will leave unchanged the SPECULAR and EMISSION values.Another proposal which would fix 100% the problem is to use glMaterial instead of glColor on the trihedron drawing loop.

With Owner

Sioutis Fotios

Fotis Sioutis's picture

A complete solution (as implemented in my application would be)..
...
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);

glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, aNULLColor);***
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, aNULLColor);***
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, aNULLColor);***

glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.);***

glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
.....

starred lines are the new ones...
the variable aNULLColor is :

GLfloat aNULLColor[] = { 0.0, 0.0, 0.0, 0.0f };

implemented at the beginning of the function.

Also a much better visually result can be achieved by raising the diameter of the sphere at the beginning of the axes.Instead of aCylinderDiametr i used aCylinderDiametr*2 in function:

gluSphere(aQuadric, aCylinderDiametr*2, NbFacettes, NbFacettes);

Greets

Sioutis Fotis

Hugues Delorme's picture

Many thanks to you Fotis, I have not tried yet to apply the bug fixes you proposed, I hope the OpenCascade dev team will in the next plublic release.

I simply want to encourage you to continue on giving back in the forum the problems and fixes you find in OpenCascade. It *really* helps the community and developpers like me that uses OCC but have no time and expertise to go inside OpenCascade dark internals.

Please continue!

P Dolbey's picture

Well 6.3 came out, but none of the triedron code patches submitted by the community were ever applied. I've applied a hybrid of my previous 6.2 patches with some of the simpler rendering ideas provided by Fotis - the diffs to 6.3 can be seen here -

http://qtocc.svn.sourceforge.net/viewvc/qtocc/occ630/ros/src/OpenGl/Open...

Pete