提问人:D Morris Watch Dog Tutorials 提问时间:11/13/2023 最后编辑:D Morris Watch Dog Tutorials 更新时间:11/13/2023 访问量:26
我的金字塔直立的正确 GLfloat 顶点是什么?[关闭]
What are the correct GLfloat vertices for my Pyramid to sit upright? [closed]
问:
我为我的金字塔添加的坐标都有效,它只是以奇怪的角度加载。我需要切换什么坐标才能使金字塔像坐在水平地面上一样直立。
这是它目前的样子。
我以为这是我的纹理坐标的问题。
以下是我正在使用的顶点和纹理坐标:
// Implements the UCreateMesh function
void UCreateMesh(GLMesh &mesh)
{
// Vertex Data
GLfloat verts[] = {
//Positions //Texture Coordinates
-1.0f, -1.0f, 0.5773f, -1.0f,-1.0f,
0.0f, -1.0f, -1.15475f, 0.0f, 0.0f,
1.0f, -1.0f, 0.5773f, 1.0f,-1.0f,
0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
-1.0f, -1.0f, 0.5773f, -1.0f, 0.0f,
0.0f, -1.0f, -1.15475f, 0.0f, 0.0f,
1.0f, -1.0f, 0.5773f, 1.0f, 1.0f,
-1.0f, -1.0f, 0.5773f, -1.0f, 0.0f,
0.0f, -1.0f, -1.15475f, 0.0f, 0.0f,
1.0f, -1.0f, 0.5773f, 1.0f, 1.0f,
0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
-1.0f, -1.0f, 0.5773f, -1.0f, 0.0f,
0.0f, -1.0f, -1.15475f, 0.0f, 0.0f,
1.0f, -1.0f, 0.5773f, 1.0f, 1.0f,
0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
};
const GLuint floatsPerVertex = 3;
const GLuint floatsPerUV = 2;
mesh.nVertices = sizeof(verts) / (sizeof(verts[0]) * (floatsPerVertex + floatsPerUV));
glGenVertexArrays(1, &mesh.vao); // we can also generate multiple VAOs or buffers at the same time
glBindVertexArray(mesh.vao);
答: 暂无答案
评论