1

After generating a cube with triangle strips, odd deformities, in the form of planes, are created: example My triangle strip measurements come from this question: Cube using single GL_TRIANGLE_STRIP

Here is my drawCube function:

def drawRec():
    glColor3f(255, 0, 0)
    cubePoints = [
        -1.0, 1.0, 1.0,     # Front-top-left
        1.0, 1.0, 1.0,      # Front-top-right
        -1.0, -1.0, 1.0,    # Front-bottom-left
        1.0, -1.0, 1.0,     # Front-bottom-right
        1.0, -1.0, -1.0,    # Back-bottom-right
        1.0, 1.0, 1.0,      # Front-top-right
        1.0, 1.0, -1.0,     # Back-top-right
        -1.0, 1.0, 1.0,     # Front-top-left
        -1.0, 1.0, -1.0,    # Back-top-left
        -1.0, -1.0, 1.0,    # Front-bottom-left
        -1.0, -1.0, -1.0,   # Back-bottom-left
        1.0, -1.0, -1.0,    # Back-bottom-right
        -1.0, 1.0, -1.0,    # Back-top-left
        1.0, 1.0, -1.0      # Back-top-right
        ]
    glEnableClientState(GL_VERTEX_ARRAY)
    glVertexPointer(3, GL_FLOAT, 0, cubePoints)
    glDrawArrays( GL_TRIANGLE_STRIP, 0, 52)
    glDisableClientState(GL_VERTEX_ARRAY)

Is there any way I can remove these planes? What is going on here?

genpfault
  • 51,148
  • 11
  • 85
  • 139
User 12692182
  • 927
  • 5
  • 16
  • 4
    Third parameter of the `glDrawArrays` is `count`, why do you pass 52? The `cubePoints` has 14 vertices. – Doj Jan 10 '21 at 02:35
  • THANK YOU. That fixed it. I defined 52 because I was not able to put it into array format, so I assumed it would require individual values. – User 12692182 Jan 10 '21 at 02:38

0 Answers0