I also rebuilt for my other two platforms, and here are the results: OS = Red Hat 7.3 CPU = Athlon 1.2 GHz GFX = GeForce 2Ti Default location went from 32 FPS to 38 FPS = 19% Default orientation
OS = Mac OS X 10.1.5 CPU = G4 867 MHz GFX = GeForce 3 Default location went from 12 FPS to 34 FPS = 183% (I double checked this) ! Default orientation On Tuesday, July 9, 2002, at 08:37 PM, Norman Vine wrote: > Hi All > > I got a considerable boost in the frame rate from the following > patch to PLib. < ~25% at default startup location > > > I am trying to determine if this also true for 'most' systems > before advocating it's inclusion into PLib > > If you do test this please report back with your results > and system type < OS, CPU, GFX card > > > Thanks > > Norman > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf Of Darrell > Walisser > Sent: Sunday, June 30, 2002 10:27 PM > To: [EMAIL PROTECTED] > Subject: [Plib-devel] ssg vertex tables tuning > > > Hi all, > While running FlightGear, I noticed a problem with PLIB's vertex > tables. The implementation is fine, but performance was hideous on Mac > OS X (like 5fps), even on a fast G4. I'm really curious if this is also > a problem on other OS's. > > After some examination, it seems the majority of FlightGear's geometry > is rendered in small triangle fans, of 5-10 vertices each, with the > occasional big lump of vertices in a detailed area. Why is this a > problem? Well, it turns out that the setup time for vertex arrays is > actually slower than glVertex3fv() etc because there are so few vertices > per table. > > So, I coded a solution that only kicks into the vertex array code if the > number of vertices is beyond a certain threshold, otherwise it uses > glVerte3fv(). I picked 25 as the lower bound for vertex arrays, but this > value is probably highly system-dependent and we might want to make it > configurable either at build-time or run-time. > > Here's the code (for ssgVtxTable.cxx). Having different versions of the > inner loop is probably overkill, but you get the idea: > > void ssgVtxTable::draw_geometry () > { > const int LOWER_BOUND = 25; > > int num_vertices = getNumVertices () ; > int num_colours = getNumColours () ; > int num_normals = getNumNormals () ; > int num_texcoords = getNumTexCoords () ; > > if ( num_colours == 0 ) glColor4f ( 1.0f, 1.0f, 1.0f, 1.0f ) ; > if ( num_colours == 1 ) glColor4fv ( colours -> get(0) ) ; > if ( num_normals == 1 ) glNormal3fv ( normals -> get(0) ) ; > > #define LOOP(c,n,t) do { \ > glBegin(gltype); \ > for ( int i = 0; i < num_vertices; i++) \ > { \ > if(c) glColor3fv(colors[i]); \ > if(n) glNormal3fv(normals[i]); \ > if(t) glTexCoord2fv(texcoords[i]); \ > glVertex3fv(vertices[i]); \ > } \ > glEnd(); \ > } while(0) > > // write out the branches > // to keep branches out of the inner loop > if (num_vertices < LOWER_BOUND) { > > float *tmp; > tmp = colours->get(0); sgVec4 *colors = (sgVec4*) tmp; > tmp = normals->get(0); sgVec3 *normals = (sgVec3*) tmp; > tmp = texcoords->get(0); sgVec2 *texcoords = (sgVec2*) tmp; > tmp = vertices->get(0); sgVec3 *vertices = (sgVec3*) tmp; > > if ( num_colours > 1 ) { > if ( num_normals > 1 ) { > if ( num_texcoords > 1 ) > LOOP(1,1,1); > else > LOOP(1,1,0); > } > else if ( num_texcoords > 1 ) { > LOOP(1,0,1); > } > else { > LOOP(1,0,0); > } > } > else if ( num_normals > 1 ) { > if ( num_texcoords > 1 ) { > LOOP(0,1,1); > } > else { > LOOP(0,1,0); > } > } > else if ( num_texcoords > 1 ) { > LOOP(0,0,1); > } > else { > LOOP(0,0,0); > } > > } > else { > > glPushClientAttrib ( GL_CLIENT_VERTEX_ARRAY_BIT ) ; > > if ( num_colours > 1 ) > { > glEnableClientState ( GL_COLOR_ARRAY ) ; > glColorPointer ( 4, GL_FLOAT, 0, colours->get(0) ) ; > } > > if ( num_normals > 1 ) > { > glEnableClientState ( GL_NORMAL_ARRAY ) ; > glNormalPointer ( GL_FLOAT, 0, normals->get(0) ) ; > } > > if ( num_texcoords > 1 ) > { > glEnableClientState ( GL_TEXTURE_COORD_ARRAY ) ; > glTexCoordPointer ( 2, GL_FLOAT, 0, texcoords->get(0) ) ; > } > > glEnableClientState ( GL_VERTEX_ARRAY ) ; > glVertexPointer ( 3, GL_FLOAT, 0, vertices->get(0) ) ; > > glDrawArrays ( gltype, 0, num_vertices ) ; > > glPopClientAttrib () ; > } > } > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > plib-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/plib-devel > > > _______________________________________________ > Flightgear-devel mailing list > [EMAIL PROTECTED] > http://mail.flightgear.org/mailman/listinfo/flightgear-devel _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
