全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3889
推到 Plurk!
推到 Facebook!

關於openGL 三角網格的問題

尚未結案
3358
一般會員


發表:4
回覆:0
積分:0
註冊:2005-09-21

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-09-25 10:42:46 IP:140.116.xxx.xxx 未訂閱
在寫取程式的時候,發現無法讀取STL的檔案,請問有沒有高手可以指證一下我的宣告到底是哪裡出了問題, 應該要怎麼樣宣告才能夠順利讀取 Compiling... test.cpp Linking... test.obj : error LNK2001: unresolved external symbol "struct STriangle * __cdecl LoadStlASCII(char const *,int &)" (?LoadStlASCII@@YAPAUSTriangle@@PBDAAH@Z) Debug/test.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. test.exe - 2 error(s), 0 warning(s) 下面是原始程式碼 #include #include #include #include #include "inputStl.h" // Rotation amounts static GLfloat xRot = 0.0f; static GLfloat yRot = 0.0f; //triangles STriangle * triArray = NULL; int nTriangles = 0; // Called to draw scene void RenderScene() { // Clear the window glClear(GL_COLOR_BUFFER_BIT); // Save matrix state and do the rotation glPushMatrix(); glRotatef(xRot, 1.0f, 0.0f, 0.0f); glRotatef(yRot, 0.0f, 1.0f, 0.0f); for (int i=0; i { glBegin(GL_TRIANGLES); glVertex3f(triArray[i].a[0], triArray[i].a[1], triArray[i].a[2]); glVertex3f(triArray[i].b[0], triArray[i].b[1], triArray[i].b[2]); glVertex3f(triArray[i].c[0], triArray[i].c[1], triArray[i].c[2]); glEnd(); } // Restore transformations glPopMatrix(); // Flush drawing commands glutSwapBuffers(); } void SetupRC() { // Black background glClearColor(0.0f, 0.0f, 0.0f, 1.0f ); // Set drawing color to blue glColor3ub(0, 0, 255); } void SpecialKeys(int key, int x, int y) { if(key == GLUT_KEY_UP) xRot-= 5.0f; if(key == GLUT_KEY_DOWN) xRot = 5.0f; if(key == GLUT_KEY_LEFT) yRot -= 5.0f; if(key == GLUT_KEY_RIGHT) yRot = 5.0f; if(xRot > 356.0f) xRot = 0.0f; if(xRot < -1.0f) xRot = 355.0f; if(yRot > 356.0f) yRot = 0.0f; if(yRot < -1.0f) yRot = 355.0f; // Refresh the Window glutPostRedisplay(); } void ChangeSize(int w, int h) { //GLfloat nRange = 1.9f; GLfloat nRange = 500.0f; // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h); // Reset projection matrix stack glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Establish clipping volume (left, right, bottom, top, near, far) if (w <= h) glOrtho (-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange*100, nRange*100); else glOrtho (-nRange*w/h, nRange*w/h, -nRange, nRange, -nRange*100, nRange*100); // Reset Model view matrix stack glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void main() { triArray = LoadStlASCII("Sammy1_ascii.stl", nTriangles); //triArray = LoadStlBinary("Sammy1_binary.stl", nTriangles); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutCreateWindow("STL Loading Sample"); glutReshapeFunc(ChangeSize); glutSpecialFunc(SpecialKeys); glutDisplayFunc(RenderScene); SetupRC(); glutMainLoop(); }
yangkissktop
一般會員


發表:13
回覆:29
積分:8
註冊:2003-10-25

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-11-01 05:10:20 IP:59.104.xxx.xxx 未訂閱
LoadStlASCII()函數其原型應在inputStl.h可找到該行 您的錯誤訊息為"unresolved external symbol" 表示編譯時inputStl.h已告知LoadStlASCII()函數原型 但在鏈結時錯誤 =>> 請找一下該函數有否提供相關之 *.lib或*.dll檔案吧 ! 祝順心~~~~~~~ yangkissktop
------
yangkissktop
系統時間:2024-03-29 23:43:34
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!