Jump to content
  • Advertisement
Sign in to follow this  

All Objects not drawing

This topic is 3797 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am pretty frustrated. I have a linked list with a set of commands to either draw a block or sphere (from display lists). All the blocks are drawn except one. No idea why. void display( void ) { glClear(GL_COLOR_BUFFER_BIT); list<float>::iterator di=dataList.begin(); for(list<char>::iterator ai=commandList.begin(); ai!=commandList.end(); ++ai) { cout << "CURRENT ITEM: " << *ai << ": " << endl; float x,y,z; switch (*ai) { case 'c' : x = *di; di++; y = *di; di++; z = *di; di++; cout << "color change: " << *di << "," << y << "," << z << endl; glColor3f(x,y,z);//Change the object color break; case 'b' : x = *di; di++; y = *di; di++; z = *di; di++; cout << "block drawn:" << x << y << z << endl; glPushAttrib(GL_ALL_ATTRIB_BITS); glPushMatrix(); glTranslatef(x,y,z); //x,y,z x = *di; di++; y = *di; di++; z = *di; di++; glScalef(x,y,z); glCallList(2); glPopAttrib(); glPopMatrix(); break; case 's' : x = *di; di++; y = *di; di++; z = *di; di++; glPushAttrib(GL_ALL_ATTRIB_BITS); glPushMatrix(); glTranslatef(x,y,z); //x,y,z z = *di; di++; glScalef(1,1,z); glCallList(3); glPopAttrib(); glPopMatrix(); break; }//switch }//for glFlush(); }//void //Initialize world without objects void myInit() { glClearColor (wc1, wc2, wc3, 0.0); createDisplayLists(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(worldxBegin,worldxEnd,worldyBegin,worldyEnd); glMatrixMode(GL_MODELVIEW); }//void int main(int argc, char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(windowX,windowY); //Center on screen int windowPosx = (glutGet (GLUT_SCREEN_WIDTH) - windowX)/2; int windowPosy = (glutGet (GLUT_SCREEN_HEIGHT) - windowY)/2; glutInitWindowPosition(windowPosx,windowPosy); glutCreateWindow("Hi"); glutKeyboardFunc(keypress); //Exit program when q or ESC is pressed createMenu(); glutDisplayFunc(display); myInit(); glutMainLoop(); return 0; }

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!