Which way to display a map
I have a problem with my opengl engine. I have a terrain map, which is generated randomly, this works all fine. Then the generated map is stored in objects for each triangle. Now, if iam going to draw the map, i just go throught each object, that looks like so:
for (x =0; x<50;x++) {
for (y=0;y<50;y++) {
triangle[x][y].draw();
}
}
So you got the idea, Im using a for-next loop do go through each triangle of the map and draw it. This is where my problem is. This is very slow if i have a bigger terrain. Would my engine be much faster if i go through all triangles using Linked-Lists ? Please dont tell me that i should use something Like BSP, Octree or something else since my map is only 50x50 quads large, so i think, it should at least now still be fast without sorting algorithms. I hope you got the idea and can help me.
Thanks,
SRMeister
I'm not sure what you're doing, but the only thing i can think of, to speed this up is:
for (x =0; x<50;x++) {
for (y=0;y<50;y++) {
if ( the triangle will show up on the screen )
triangle[x][y].draw();
}
}
// I can't tell you how to write the if statement because i don't know if your app is 3D, or the display mode, or anything.
Edited by - myself on December 26, 2000 4:32:21 PM
for (x =0; x<50;x++) {
for (y=0;y<50;y++) {
if ( the triangle will show up on the screen )
triangle[x][y].draw();
}
}
// I can't tell you how to write the if statement because i don't know if your app is 3D, or the display mode, or anything.
Edited by - myself on December 26, 2000 4:32:21 PM
Umm I think you misunderstood me. Dont you too think, that a total of 50x50 trinagels would be displayed faster than like 20fps ? i think, a FOR Loop is just to slow to go over each triangle and draw it. Also, do you think iam using OpenGL for 2D mode ?? hehe, as i said, its a 3D Terrain engine, i just started to code it yesterday and since it is my first 3D Engine i was wondering how one would go through the Triangle List. I heard somewhere, that storing the map data in an array is slow, so i need to know if this is true. Please excuse my bad english. Hope you got an idea what my problem is.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement