I just recently changed my linked list over to a queue in my project since the linked list was having issues ending when at the end of the list. The queue works great, sort of, since I can get the size of the queue and stop the function once the size is reached. However, here is my problem. I can compile the program and it will run without any problems, and exactly as it i want it too. Then when I run the .exe file by clicking it the window comes up with "the program has encountered a problem and needs to close" message. So what are the differences between running it through the compiler/IDE vs. running it without the compiler? The part I changed is below. I should probably also note this is opengl, but the problem isn't opengl specific. If I render one object I can click the .exe and run it without the compiler and not have trouble. When I render more than one that's when I have troubles.
Code://head is the name of the queue, it is a private member of the class LOADOBJ bool LOADOBJ::RenderAllObjects() { if(head.size() == 0) return false; //nothing to render ObjectList *temp; //temp space for the render function int f_index = 0, f_index2 = 0; //face index, and non-changing face index /*render all objects to the screen*/ glPolygonMode( GL_BACK, GL_LINE ); // draw back face with lines glPolygonMode( GL_FRONT, GL_LINE ); // draw front face with lines for(int n = 1; n <= head.size(); n++){ temp = head.front(); //get the front object head.pop(); //pop the front object head.push(temp); //then put it back in line for the next time it's rendered for(int i = 0; i < temp->face_count; i++){ //determine what type needs to be rendered if(temp->vert_per_face[i] == 4) glBegin(GL_QUADS); //render squares else if(temp->vert_per_face[i] == 3) glBegin(GL_TRIANGLES); //render triangles else if(temp->vert_per_face[i] == 2) glBegin(GL_LINES); //render lines else if(temp->vert_per_face[i] == 1) glBegin(GL_POINTS); //render points else glBegin(GL_POLYGON); //if nothing else render a polygon (5 or more vertex) f_index2 = f_index; for(int n = f_index2; n < f_index2 + temp->vert_per_face[i]; n++){ //create the 3D vertex glVertex3f(temp->v_x[ temp->fv[n]-1 ], //x coordinate temp->v_y[ temp->fv[n]-1 ], //y coordinate temp->v_z[ temp->fv[n]-1 ]); //z coordinate f_index++; } glEnd(); } //end for loop f_index2 = 0; f_index = 0; } return true; }



LinkBack URL
About LinkBacks



