小编use*_*542的帖子

从 .obj 文件在 OpenGL 中绘制四边形

我正在将 .obj(在 Blender 中创建,如果有帮助的话)解析为 OpenGL 中的 C++ 程序,看起来已经很接近了。看来这里正确地找到了需要的顶点。我正在尝试创建一个可以移动的大写字母 I。这是我的解析代码:

bool loadObjectFile(const char * filepath, std::vector < glm::vec3 > & out_vertices, std::vector < glm::vec3 > & out_normals)
{
    std::vector< unsigned int > vertexIndices;
    std::vector< glm::vec3 > temp_vertices;
    std::vector< glm::vec3 > temp_normals;
    glm::vec3 tempFaceNormal;

    FILE * file = fopen(filepath, "r");
    if (file == NULL)
    {
        printf("Impossible to open the file !\n");
        return false;
    }

    while (1)
    {
        char lineHeader[128];
        // read the first word of the line
        int res = fscanf(file, "%s", …
Run Code Online (Sandbox Code Playgroud)

c++ opengl blender

3
推荐指数
1
解决办法
3026
查看次数

标签 统计

blender ×1

c++ ×1

opengl ×1