So after a long attempt at DirectX I switched back to good old OpenGL. Now I'm running into this weird problem. My code involves shaders, of course, and drawing a basic cube. But I'm getting this weird shape. I've never seen this before. I was just wondering what could possibly be causing this? Thanks very much!
Initialization:
lightingShader->GenerateVAO();
lightingShader->GenerateVBO();
lightingShader->SetVertices(vertices, sizeof(vertices), GL_STATIC_DRAW);
lightingShader->BindVAO();
{
lightingShader->AddAttribute(0, 3, GL_FLOAT, GL_FALSE, 3, 0);
}
lightingShader->UnbindVAO();
Rendering:
lightingShader->Use();
GLint objectColorLoc = lightingShader->GetUniformLocation("objectColor");
GLint lightColorLoc = lightingShader->GetUniformLocation("lightColor");
glUniform3f(objectColorLoc, 1, 0.5f, 0.31f);
glUniform3f(lightColorLoc, 1, 0.5f, 1);
GLint modelLoc = lightingShader->GetUniformLocation("model");
GLint viewLoc = lightingShader->GetUniformLocation("view");
GLint projLoc = lightingShader->GetUniformLocation("projection");
glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->View()));
glUniformMatrix4fv(projLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->Projection()));
lightingShader->BindVAO();
{
glm::mat4 model;
glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
glDrawArrays(GL_TRIANGLES, 0, 36);
}
lightingShader->UnbindVAO();
Result:
As you can see, position and color is set fine, but I still get that weird shape.

RenderDocorCodeXLto see what data is actually used to draw. \$\endgroup\$