#11 OpenGL lighting workaround

closed-accepted
nobody
None
5
2014-04-18
2010-06-12
Anonymous
No

OpenGL lighting need
one normal for each triangle for GL_FLAT lighting,
or one normal for each vertex for GL_SMOOTH lighting.

STL can contain only GL_FLAT models, but other formats are used normal for store information about form (for right tesselation).

Workaround
in pycam/Geometry/Model.py

class Model

def to_OpenGL(self):
if not GL_enabled:
return
if True:
GL.glBegin(GL.GL_TRIANGLES)
for t in self._triangles:
normal_t=t.normal() #<<<
GL.glNormal3f(normal_t.x,normal_t.y,normal_t.z) #<<<
GL.glVertex3f(t.p1.x, t.p1.y, t.p1.z)
GL.glVertex3f(t.p2.x, t.p2.y, t.p2.z)
GL.glVertex3f(t.p3.x, t.p3.y, t.p3.z)

diff file:
_________________

80a81,82
> normal_t=t.normal()
> GL.glNormal3f(normal_t.x,normal_t.y,normal_t.z)

Discussion

  • Anonymous
    Anonymous
    2010-06-12

    before and after

     
    Attachments
  • Lars
    Lars
    2010-07-15

    • status: open --> closed-accepted
     
  • Lars
    Lars
    2010-07-15

    Hi imyrek,

    thanks a lot for taking the time to fix the OpenGL lightning!
    It looks sooo much better now!

    cheers,
    Lars

     
  • new headphone traces from Soul, which performs with rapper Ludacris, and SMS Audio, which has a partnership with 50 Cent. Sony just lately introduced an X-Point branded headphone endorsed by Simon Cowell, whilst other headphones are becoming marketed by non-musicians, with New York Jets quarterback Tim Tebow and even Snooki, the reality Tv star from MTV's Jersey Shore, obtaining in on the act. [url=http://cheapbeatsbydreaol.webstarts.com/]cheap beats by dre[/url] <a href="http://cheapbeatsbydreaol.webstarts.com/" title="cheap beats by dre">cheap beats by dre</a>