GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


tristrips by luke
1
 
//glCullFace(GL_FRONT);

    StateMgr::Inst()->StateEnable(GL_CULL_FACE);
    StateMgr::Inst()->StateEnable(GL_TEXTURE_2D);

    unsigned int index;

    for(unsigned int x = 0; x < numMeshes; ++x)
    {
        if(meshes[x].matIndex != -1)
        {
            mats[meshes[x].matIndex].Apply();
        }
        
        glColor3f(1,1,1);
        
        Vert *vert    = meshes[x].vert;

        for(unsigned int y = 0; y < meshes[x].numStrips; ++y)
        {
            glBegin(GL_TRIANGLE_STRIP);
        
                for(unsigned int z = 0; z < meshes[x].strip[y].length; ++z)
                {
                    index = meshes[x].strip[y].index[z];
                    
                    glTexCoord2f    (vert[index].uv  [0], vert[index].uv  [1]);
                    glNormal3f        (vert[index].norm[0], vert[index].norm[1], vert[index].norm[2]);
                    glVertex3f        (vert[index].pos [0], vert[index].pos [1], vert[index].pos [2]);
                }

            glEnd();
        }
    }

    StateMgr::Inst()->StateDisable(GL_TEXTURE_2D);
    StateMgr::Inst()->StateDisable(GL_CULL_FACE);