Advertisement Jump to content

Archived

This topic is now archived and is closed to further replies.

Anonymous Poster

Linked Lists

This topic is 6852 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 using OpenGL to make my 3D engines, now i have a little problem. I can show the triangles on the screen, but if i want to make a big world, i need something where i can store the triangles. I think that Linked Lists would be good. If there are other ways to do that, please tell me. I know how to make linked lists but i dont know how to use them. struct LL { int x, y, z; int u, v; LL * next; } so how do i go through the list and how do i change variables at the right position.

Share this post


Link to post
Share on other sites
Advertisement
To handle through a single linked list is a very simple
operation!

LL* top; // = top of the list item
LL* ptr; // = temporary list item

// now let''s go through the list
ptr = top
// have we reached the end of the list?
while (ptr != NULL)
{
// no, do anything with the list item
printf("x: %d\n", ptr->x);
...
...
// that''s important now, update to the next item in list
ptr = ptr->next;
}

That''s all!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!