lsalzman / iqm

Inter-Quake Model format development kit
MIT License
240 stars 73 forks source link

Demo scaling curiousity #17

Open ruby0x1 opened 8 years ago

ruby0x1 commented 8 years ago

My PR (#16) came about when testing an importer. The interesting thing is that the imported mesh was flipped visually, but rendered correctly.

I stumbled on this line in the demo in particular:

glScalef(1, -1, 1);

Flipping that back to 1,1,1 the mesh was displayed inside out. Telling GL the triangles are actually clockwise winding fixes this:

glFrontFace(GL_CW);

I suspect many people copying the example may find themselves head scratching if they aren't familiar with GL, or rendering concepts in general, since scaling -1 to solve winding is unconventional and renders the textures flipped on some axis.

Since I don't want to use CW winding I preferred the export CCW flag :)