Are VBO's the answer to my speed problem ?



Hi,
As you will realize by my earlier postings to this NG I'm an OGL newbie, however I'm learning fast.
I'm developing an Interactive Earth program similar to Google Earth. Of course it'll never be as good as that though so I'm just doing it as a learning project.
I am using a nice earth texture on the sphere along with latitude and longitude data from the CIA World Databank II for the coastlines, rivers and national boundaries.
I've converted the CIA text files to my own binary format which I read into the following C structs and am happily rendering the coastlines using GL_LINE_STRIP and glVertex3fv inside two for loops. The inner loop just goes round and round until each latitude/longitude pair in the segment is drawn. The outer loop counts the segments. Each time the outer loop goes round a glBegin(GL_LINE_STRIP) is executed. This system works OK apart from the speed due to there being some 5718314 lat/lon pairs to deal with. I'm only getting about 4 frames per second on a GeForce 6200 PCI card. When I switch off the rendering of the CIA data I get around 50FPS.

Maybe a tiny bit of code and some data would help demonstrate this:-

segment 1 rank 1 points 991
31.646944 25.151389
31.646111 25.148056
31.643056 25.143333
31.640278 25.138889
31.637222 25.134167
31.634444 25.129722
.....
.....
segment 2 rank 1 points 618 <-- 618 Lat/Lon pairs
21.999722 25.002222
21.999444 25.003611
21.999444 25.008889
21.999444 25.015556
22.000000 25.021667
21.999722 25.028333
21.999444 25.035000
22.000000 25.041111

struct Vector {
float x, y, z;
};

struct Segment {
int nSegment;
int nRank;
int nPoints;
Vector *ptrPoints;
};

struct CIAData {
int nTotalSegments;
Segment *ptrSegments;
};

From the above you can hopefully see how I have my data structured.
I think converting this little lot to VBO's is the answer to my speed problems ?
What's the best way to approach this bearing in mind each segment must be dealt with separately, that's the bit that's confusing the VBO issue for me.
If say I could just go ahead and plot 5718314 points (lines) one after another with no breaks by calling glBegin(GL_LINE_STRIP) then I think I'd be OK.
I can't have a VBO for each segment that would just be daft so what's the way to deal with this please ?
Do I need to restructure my data to make things easier ?

Thanks in advance for any help you can offer

Lynton

.



Relevant Pages

  • Re: Writing to text segment
    ... memcpy((void *)&foo, buf, sizeof buf); ... volatile int i = 1; ... the behavior as per standards when one writes to .text segment. ...
    (comp.lang.c)
  • Re: Confusion between Stack and Data segment
    ... int main ... Does variable " j " get stored in the data segment as it is ... Does variable " i " get stored in the stack segment or bss ... automatic storage duration starts to live when the function defining ...
    (comp.unix.programmer)
  • Re: Age Correspondences, When Both Travelers Accelerate
    ... for determining age correspondences for two travelers who ... and mutually stationary on the earth when they are each ... and then accelerates at -1g for 4 years. ... At the end of T1's first segment, ...
    (sci.physics.relativity)
  • Re: The Blue Pigeon
    ... OK a* DO YOU MEAN 'DO YOU HAVE A BLUE GOOD OLE BOY WHO IS A DOWN TO EARTH ... RED-BLOODED ALL-AMERICAN, GUN TOTING, FLAG WAVING, GOD FEARING, HIGH MORAL ... THAT THE SEGMENT OF SOCIETY ...
    (alt.vacation.las-vegas)
  • [patch 3/6] s390: dcss segments cleanup.
    ... Cleanup segment load/unload infrastructure. ... -static void inline dcss_mkname ... +dcss_diag_translate_rc (int vm_rc) { ... * Load a DCSS segment via the diag 0x64. ...
    (Linux-Kernel)