Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Winding order #4

Open
jeannekamikaze opened this issue Jun 5, 2013 · 2 comments
Open

Winding order #4

jeannekamikaze opened this issue Jun 5, 2013 · 2 comments

Comments

@jeannekamikaze
Copy link

Unless I am mistaken, it seems that the second triangle generated from a quad should be ACD, not ADC. If a quad's vertices are given as A B C D, the two triangles generated would be ABC and ACD, otherwise half of the triangles end up clockwise and the other half counter-clockwise and then face culling fails to work properly.

if($5 != "")
        {
            @d = split('/', $5);
            $va_idx[$numFaces] = $a[0]-1;
            $ta_idx[$numFaces] = $a[1]-1;
            $na_idx[$numFaces] = $a[2]-1;

            $vb_idx[$numFaces] = $c[0]-1;
            $tb_idx[$numFaces] = $c[1]-1;
            $nb_idx[$numFaces] = $c[2]-1;

            $vc_idx[$numFaces] = $d[0]-1;
            $tc_idx[$numFaces] = $d[1]-1;
            $nc_idx[$numFaces] = $d[2]-1;

            $face_line[$numFaces] = $line;

            $numFaces++;
        }
@patr1ck
Copy link

patr1ck commented Jun 25, 2013

Hey there, inexperienced OpenGL newbie here. In my project, the objects i'm using (converted from blender .obj files to .h files using this script) are covered in a triangle checker pattern, where I half the checkered parts are completely transparent.

I can fix the problem by removing glEnable(GL_CULL_FACE);, but that seems incorrect.

Sounds like I'm hitting the above issue?

@patr1ck
Copy link

patr1ck commented Jun 25, 2013

Yep, I tried the above fix and now things work fine even with GL_CULL_FACE. Thanks @jeannekamikaze!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants