title: Dark edges and dent like artifacts when rotating a triangle
body: <p>When i rotate my triangle on the y axis it seems ok but when i rotate on the z axis it leaves some darker edges at the corners of the mesh and some dent like artifacts are visible near the corners. I can't understand why. I think the math for the rotations are correct.</p>
  <p>Here is the code</p>
  <pre><code>#include &lt;iostream&gt;
  #include &quot;dep/GLEW/glew.h&quot;
  #include &quot;dep/GLFW/glfw3.h&quot;
  
  void framebuffer_size_callback(GLFWwindow* window, int width, int height);
  void character_callback(GLFWwindow* window, unsigned int codepoint);
  void processInput(GLFWwindow* window);
  
  
  int main()
  {
  
      glfwInit();
      GLFWwindow *window;
      //window = glfwCreateWindow(800, 600, &quot;der&quot;, glfwGetPrimaryMonitor(), NULL);
      window=glfwCreateWindow(800, 600, &quot;der&quot;, NULL, NULL);
      glfwMakeContextCurrent(window);
      glewInit();
      glEnable(GL_DEPTH_TEST);
      glfwSwapInterval(1);
  
      float positions[9] =
      { -0.5f,-0.5f, 0.0f,
           0.5f,-0.5f, 0.0f,
           0.0f, 0.5f, 0.0f
      };
          unsigned int indices[] = { 0,1,2 };
          unsigned int myvertexarrayobject;
          glGenVertexArrays(1, &amp;myvertexarrayobject);
          glBindVertexArray(myvertexarrayobject);
  
          unsigned int myvertexbufferobject;
          glGenBuffers(1, &amp;myvertexbufferobject);
          glBindBuffer(GL_ARRAY_BUFFER, myvertexbufferobject);
          glBufferData(GL_ARRAY_BUFFER, 9 * sizeof(float), positions, GL_DYNAMIC_DRAW);
  
          unsigned int ebo;
          glGenBuffers(1, &amp;ebo);
          glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
          glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_DYNAMIC_DRAW);
  
          glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
          glEnableVertexAttribArray(0);
  
          const char* vertex_shader =
              &quot;#version 440 core\n&quot;
              &quot;in vec3 vp;&quot;
              &quot;uniform vec4 qtr;&quot;
              &quot;vec4 pt=vec4(vp,1.0);&quot;
              &quot;vec4 npt=vec4(-qtr[0],-qtr[1],-qtr[2],qtr[3]);&quot;
              &quot;vec4 sqtr=vec4((qtr[3]*pt[0]+qtr[0]*pt[3]+qtr[1]*pt[2]-qtr[2]*pt[1]),(qtr[3]*pt[1]-qtr[0]*pt[2]+qtr[1]*pt[3]+qtr[2]*pt[0]),(qtr[3]*pt[2]+qtr[0]*pt[1]-qtr[1]*pt[0]+qtr[2]*pt[3]),(qtr[3]*pt[3]-qtr[0]*pt[0]-qtr[1]*pt[1]-qtr[2]*pt[2]));&quot;
              &quot;vec4 npoint=vec4((sqtr[3]*npt[0]+sqtr[0]*npt[3]+sqtr[1]*npt[2]-sqtr[2]*npt[1]),(sqtr[3]*npt[1]-sqtr[0]*npt[2]+sqtr[1]*npt[3]+sqtr[2]*npt[0]),(sqtr[3]*npt[2]+sqtr[0]*npt[1]-sqtr[1]*npt[0]+sqtr[2]*npt[3]),(sqtr[3]*npt[3]-sqtr[0]*npt[0]-sqtr[1]*npt[1]-sqtr[2]*npt[2]));&quot;
              &quot;void main() {&quot;
              &quot;  gl_Position =npoint;&quot;
              &quot;}&quot;;
          const char* fragment_shader =
              &quot;#version 440 core\n&quot;
              &quot;out vec4 frag_colour;&quot;
              &quot;void main() {&quot;
              &quot;  frag_colour = vec4(0.2, 0.5, 1.0, 1.0);&quot;
              &quot;}&quot;;
  
          GLuint vs = glCreateShader(GL_VERTEX_SHADER);
          glShaderSource(vs, 1, &amp;vertex_shader, NULL);
          glCompileShader(vs);
          GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
          glShaderSource(fs, 1, &amp;fragment_shader, NULL);
          glCompileShader(fs);
  
          GLuint shader_programme = glCreateProgram();
          glAttachShader(shader_programme, fs);
          glAttachShader(shader_programme, vs);
          glLinkProgram(shader_programme);
          glDeleteShader(vs);
          glDeleteShader(fs);
  
  
          int countt = 0;
          float i = 0.0f;
          float ki(sin((i / 2)));
          float kj(0.0f);
          float kl(cos((i / 2)));
          
          std::cout &lt;&lt; glGetString(GL_VERSION) &lt;&lt; std::endl;
          std::cout &lt;&lt; glGetString(GL_VENDOR) &lt;&lt; std::endl;
          std::cout &lt;&lt; glGetString(GL_SHADING_LANGUAGE_VERSION) &lt;&lt; std::endl;
          std::cout &lt;&lt; glGetString(GL_RENDERER) &lt;&lt; std::endl;
          while (!glfwWindowShouldClose(window))
          {
              if (countt &lt; 180 &amp;&amp; countt &gt;= 0)
              {
                  i = i + 0.1f;
                  ki = sin(i / 2);
                  kl = cos(i / 2);
                  countt++;
              }
              else if (countt &gt;= 180 &amp;&amp; countt &lt; 360)
              {
                  i = i - 0.1f;
                  ki = sin(i / 2);
                  kl = cos(i / 2);
                  countt++;
              }
              else
              {
  
                  countt = 0;
              }
              int widt;
              int hei;
              glfwGetFramebufferSize(window, &amp;widt, &amp;hei);
              glViewport(0, 0, widt, hei);
              glfwSetCharCallback(window, character_callback);
              processInput(window);
              glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  
              glUseProgram(shader_programme);
  
              glBindVertexArray(myvertexarrayobject);
              GLuint transformLoc = glGetUniformLocation(shader_programme, &quot;qtr&quot;);
  
              glUniform4f(transformLoc, kj, kj, ki, kl);
              
              glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, 0);
  
              //swap front and back buffers
              
              glfwSwapBuffers(window);
              //poll for and procces events
              glfwPollEvents();
  
          }
  
      glfwTerminate();
      
      return 0;
  }
  
  
  void processInput(GLFWwindow* window)
  {
      if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
      {
          glfwSetWindowShouldClose(window, true);
      }
  
  }
  
  void character_callback(GLFWwindow* window, unsigned int codepoint)
  {
      std::cout &lt;&lt; (char)codepoint &lt;&lt; std::endl;
  }
  
  void framebuffer_size_callback(GLFWwindow* window, int width, int height)
  {
      // make sure the viewport matches the new window dimensions; note that width and 
      // height will be significantly larger than specified on retina displays.
      glViewport(0, 0, width, height);
  }
  
  </code></pre>