Newbish Question on Display Lists
Okay, I am creating a 3D world based off the tutorials on this site as a project for my programming class. I adapted some code from lesson 10 as a way to get 3D movement and added in some effects like gravity, jumping, etc. Anyways, I hit lesson 12 and found that display lists would be a very welcome way to speed up my program since the method I used was looping the creation of texture mapped squares to have a tile effect. Needless to say, a simple room was fairly slow with the creation of 1000s of squares. I converted all the tiles I use into display list format, but am having troubles getting them to actually display. Since calling from a display list puts the object to where ever the camera is translated, some really odd things happen when I try to draw the scene. I seem to be able to draw the scene but not be able to move since the illusion of movement I use utilizes the same rotate and traslate functions. Any ideas and help you guys could throw my way would be greatly appreciated!
Once a display list is compiled, it draws the exact same thing every time. So if your glRotate and glTranslate calls are ''inside'' the display list, it will always render with the initial values. You should do the glRotate/glTranslates for movement outside of the display list:
// Account for movement
glRotatef( ... );
glTranslatef( ... );
// Draw the 3D world
glCallList( ... );
If you already do this, then we''ll have to dig a little deeper.
// Account for movement
glRotatef( ... );
glTranslatef( ... );
// Draw the 3D world
glCallList( ... );
If you already do this, then we''ll have to dig a little deeper.
OK, I surfed a bit and found a tutorial on matrices. I used those and it is now working perfectly. Well, except for the fact that my fps drops even worse now
. I cut down the room to use only about 100 squares so far, but it is still pretty terrible. If you guys have any ideas on how to reduce the performance hit, I would be grateful. I could reduce the tile texture quality or create bigger tiles or something along those lines, but I really don''t want to if I don''t have to!

This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement