Jump to content
  • Advertisement
Sign in to follow this  
wangdiweilu

Can I destroy display lists and recreate it at once?

This topic is 4145 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

I have created a few display lists; the index value is saved in a fixed array. When I render the scene, l call the lists, after the moment, part of the lists are recreated and saved in the same position of the array. But I sorry that I don’t see the scene the recreated list creates. The scene is made up of a sea of data, it is impossible to create all lists at start. void RenderScene(void) { …. InvertIndex(); ….. for(int i = 0; i < 6; i++) { for(int j = 0; j < 6; j++) {glCallList(hlindexList[j]); } … } } void InvertIndex(void) { if(…..) { ….. for(i=0;i<6;i++) { //the array of position saves the address of a few of map data position[0]=position[6]; position[1]=position[7]; glDeleteLists(3,12);//3 is created by glGenLists(6) at the first time //the address change,and the lists are recreated drawMap_file_hl(0,*(position[0])); drawMap_file_hl(1,*(position[1])); ….. } if(….) { … for(int i=0;i<6;i++) { position[0]=Index_hl[0][1]; position[1]=Index_hl[0][2]; } glDeleteLists(3,12); drawMap_file_hl(0,*(position[0])); drawMap_file_hl(1,*(position[1])); ……. } } BOOL drawMap_file_hl(GLuint mapindex,int address) { …… hlindexHeadList[mapindex] = glGenLists(6); …… for(int i = 0; i < 6; i++) { hlindexList[mapindex] = hlindexHeadList[mapindex] + i; glNewList(hlindexList[mapindex], GL_COMPILE); …… glEndList(); } }

Share this post


Link to post
Share on other sites
Advertisement
You may be calling glDeleteLists(...) wrong?
If you're going to delete a single list, use glDeleteLists(THE_DISPLAY_LIST,1);



int displaylist[6][6];

void init()
{
for(int x=0; x < 6; x++)
for(int y=0; y < 6; y++)
displaylist[x][y] = glGenLists(1);

createDisplaylists();
};

void createDisplaylists()
{

for(int x=0; x < 6; x++)
for(int y=0; y < 6; y++)
{
glNewList(displaylist[x][y],GL_COMPILE);
//draw stuff....
glEndList();
}
};

void freeDisplaylists()
{
for(int x=0; x < 6; x++)
for(int y=0; y < 6; y++)
{
glDeleteLists(displaylist[x][y],1);
}
}

void render()
{

for(int x=0; x < 6; x++)
for(int y=0; y < 6; y++)
{
glCallList(displaylist[x][y]);
}
};

void main()
{
init();
while (gamerunning)
{
render();
}
freeDisplaylists();
};





Hopefully there's no typos, hehe.

/Robert

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!