Jiba <[EMAIL PROTECTED]> writes:

> The normal doesn't have to be restored, since Soya doesn't consider
> a default value for it.

The problem is that the normal set for some other object is still in
force, and lines (and points) don't set their own normal. I think
line_bug.py demonstrates this -- the triangle has opposite
orientations (and presumably opposite normals) in the two cases. In
the one case the normal is presumably pointing more-or-less the right
way, but not the other.

Anyway, my original patch works ;) and the clean-up-after-yourself
approach it uses seems ``right'' to me. For instance, if some other
line-drawing code (outside Face) is called, the normal will be correct
if this patch is used. Although I don't know OpenGL at all, I'd sort
of except the whole set of render() calls to be between
glPushAttrib(GL_CURRENT_BIT | GL_<otherstuff> | ...) and glPopAttrib()
calls.

> The "Dark line bug" problem is elsewhere : it is not possible to
> compute a normal for a line, of course. As a consequence, lines are
> not lit correctly...

It does seem odd that a line can have a normal.

> A "perfect" solution is probably to use
> Vector(renderer.current_camera, 0.0, 0.0, 1.0) as a normal if
> self._normal is None. Can you try it ? I'm short in time to try it
> myself, sorry :-/

Below is a patch implementing this: it also works. I'm as much a
novitiate in Pyrex as OpenGL (that <_Vector> 'casting' notation looks
very odd!), so please excuse any errors in style.

Regards,

Rory


*** face.pyx.~1.14.~    2005-07-30 12:00:06.000000000 +0200
--- face.pyx    2005-10-31 21:33:00.000000000 +0200
***************
*** 305,311 ****
        glDisable(GL_CULL_FACE)
        
      self._compute_normal()
!     if not self._normal is None: glNormal3fv(self._normal._matrix)
      
      if   i == 1: glBegin(GL_POINTS)
      elif i == 2: glBegin(GL_LINES)
--- 305,315 ----
        glDisable(GL_CULL_FACE)
        
      self._compute_normal()
!     if not self._normal is None:
!       glNormal3fv(self._normal._matrix)
!     else:
!       atcamera=Vector(renderer.current_camera,0.0,0.0,1.0)
!       glNormal3fv((<_Vector> atcamera)._matrix)
      
      if   i == 1: glBegin(GL_POINTS)
      elif i == 2: glBegin(GL_LINES)

Reply via email to