c/c++语言开发共享运行时检查失败#0:为什么我得到这个以及它是什么意思?

在我的程序中(用于作业),我将一个顶点和法线等模型加载到我所拥有的结构中。 在绘制时,我将模型传递给函数void drawModel(Model model) 。 这样做会给我这个错误:

 Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention. 

我环顾四周,一个答案似乎是因为我传递的内容太大而且弄乱了编译器。 所以我尝试更改它,以便drawModel函数接受一个指向结构的指针(我应该以…开头),但是一旦我在函数中访问它,我就会得到那个错误。

我怎么能绕过这个? 为什么会发生这种情况?

这是整个function

 void drawModel(Model * model) { int i, g; //i is the main iterator, g keeps track of what part we're on int edge; //The current edge we're on g = 0; for(i = 0; i faceCount); i++) //This is just to test why it's occuring { } glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_FLOAT, 0, model->vertices); glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(3, GL_FLOAT, 0, model->normals); for(i = 0; i faceCount); i++) //Right here is where i get the error { if(i == model->parts[g]) { //Set colour to the part colour g++; } glDrawElements(GL_POLYGON, model->faces[i].edges, GL_UNSIGNED_BYTE, model->faces[i].edge); } } 

注意:我之前从未使用过GL顶点数组,这是我的第一次尝试。

我这样调用drawModel: drawModel(&plane);

    问题是

     glNormalPointer(3, GL_FLOAT, 0, model->normals); 

    它应该读

     glNormalPointer(GL_FLOAT, 0, model->normals); 

      以上就是c/c++开发分享运行时检查失败#0:为什么我得到这个以及它是什么意思?相关内容,想了解更多C/C++开发(异常处理)及C/C++游戏开发关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/c-cdevelopment/522075.html

      (0)
      上一篇 2020年12月9日
      下一篇 2020年12月9日

      精彩推荐