GLObject Class - work but no display
this is my first post, so i want to say "Hi everybody".
some friends and i working on a mmorpg-devkit with client and server. we tested most of the things in delphi, and its works fine. the last weekend we decided to translate the code to c++, but all my friends hate that shrederred syntax of C. they said something about "ugly" and "ugh". thats were i came into the game. normaly im the designer, im working on the design of our server-client modell, and normaly the others code the stuff. my c++ experiences are not the best, and i tryed to translate the code into c++. all tests worked fine (modified flashy-funky NEHE tuts). the night at saturday was getting longer and longer and the dutchs passed more often then the cars in our street. %) highly "iluminated", i thought, "lets translate the globject to c++".
30 minutes later i compiled the globject-class and a demo programm which is using the class, but the screen was still black and nothing was drawn. we tryed everything. rewriten code here, and there, tryed to move the object (if its drawn, it could behind the cam) but there is no object. 4 hours later we stoped, and talked about that shit we produced. the class is working, the demo-mainprocedure is working, the memory is filled with floats of the vertexs but our 3vertex-1polygon-1object is not visible. so i hope some of u guys can help me and tell, why or where the error is. btw, my c++ is not really good, so i worked with fix arrays and i didnt used pointers. (self learning programming is more complicated cause i got noone who can answer my question)
here is the link for the source
[link removed] everything works now.
[edited by - AtomX on January 20, 2004 5:27:14 AM]
Problem: C++ arrays start at index 0!
calls:
Here you are working on AllPolygons[1], when you should be working on AllPolygons[0]. Change the call to myobject[0].AddVertex to:
Enigma
myobject[0].AddVertex(1,1.0f,0.0f,0.0f,0.0f,0.0f,0.0f);
calls:
int globject::AddVertex(int PolygonNum, float avcolor_r, float avcolor_g, float avcolor_b, float avpos_x, float avpos_y, float avpos_z){ int result; AllPolygons[PolygonNum].vertex[AllPolygons[PolygonNum].NumOfVertex].vcolor_r = avcolor_r; AllPolygons[PolygonNum].vertex[AllPolygons[PolygonNum].NumOfVertex].vcolor_g = avcolor_g; AllPolygons[PolygonNum].vertex[AllPolygons[PolygonNum].NumOfVertex].vcolor_b = avcolor_b; AllPolygons[PolygonNum].vertex[AllPolygons[PolygonNum].NumOfVertex].vpos_x = avpos_x; AllPolygons[PolygonNum].vertex[AllPolygons[PolygonNum].NumOfVertex].vpos_y = avpos_y; AllPolygons[PolygonNum].vertex[AllPolygons[PolygonNum].NumOfVertex].vpos_z = avpos_z; result = AllPolygons[PolygonNum].NumOfVertex; AllPolygons[PolygonNum].NumOfVertex++; return result;};
Here you are working on AllPolygons[1], when you should be working on AllPolygons[0]. Change the call to myobject[0].AddVertex to:
myobject[0].AddVertex(0,1.0f,0.0f,0.0f,0.0f,0.0f,0.0f);
Enigma
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement