所以我看了同样问题的其他人的代码,这通常是缺少指针的问题,我似乎无法解决这个问题,
**error: conversion from
`glm::vec2 {aka glm::detail::tvec2<float, (glm::precision)0u>}` to non-scalar type `glm::vec3 {aka glm::detail::tvec3<float, (glm::precision)0u>}` requested.**
#include <stdio.h>
#include <GL/glew.h>
#include "graphics.h"
#include "mesh.h"
#include "shader.h"
#include "texture.h"
int main(){
CreateWindow(800, 600, "Hello World!");
glm::vec3 vertices[] = {glm::vec3(-0.5, -0.5, 0), glm::vec2(0, 0),
glm::vec3(0, 0.5, 0), glm::vec2(0.5, 1.0),
glm::vec3(0.5, -0.5, 0), glm::vec2(1.0, 0),
};
CreateMesh(vertices, (sizeof(vertices)/sizeof(vertices[0])));
initialiseShader("./res/basicShader");
initialiseTexture("./res/bricks.jpg");
代码:
while(!IsClosed()){
Clear(0.0f, 0.15f, 0.3f, 1.0f);
Bind();
Bind(0);
Draw();
Update();
}
return 0;
}
答案 0 :(得分:0)
您正试图从vertices
和glm::vec3
混合构建glm::vec3
,这是一个glm::vec2
的数组。