Gents,

After being prodded by several people (and I thank you all ;-) I did a quick and dirty compile of the latest plib/SimGear/FlightGear. This contains an updated version of my plib optimization that results in a similar boost in frame rate, on Mac OS X in particular. I haven't done any testing to prove it, but fgfs appears to be working OK and doing what it is supposed to do.

You'll find the latest binary at:

http://homepage.mac.com/walisser/Menu3.html , then click on "Downloads" and go to "FlightGear"

The binary was compiled on 10.3, so it may not work on 10.1 or 10.2. Please report back so we can put the proper disclaimer on the download page at flightgear.org.


As far as compiling, there are two patches required to SimGear (see below for diff). The first one should be self-explanatory. The second one is required because the default stack limit in Mac OS X is 256K. The "unlimit" command is the other option, but I don't feel anyone should be forced to use it just to get fgfs to run.


Additionally, I was forced to drop in my threaded audio code into plib, because apparently plib/sl has been broken and I get missing symbol errors when linking. But that's OK since my code results in much better audio with no dropouts (period!) and minimum latency. You can pick up this code at the previous link in the "sl.tar.gz" file and just drop that into plib and reconfigure/recompile.

I also applied the old ssgVtxTable optimization to plib, which keeps OpenGL from going down a very slow path and substantially boosts frame rates. This patch is different from the original immediate-mode hack but shows similar results and still uses drawarrays. At some point (now a long time ago) I concluded that the glPushClientAttrib()/glPopClientAttrib() calls and their consequences were the real killer so I've eliminated them in this patch.

===================================================================
RCS file: /var/cvs/SimGear-0.3/SimGear/simgear/metar/Local.h,v
retrieving revision 1.2
diff -u -r1.2 Local.h
--- simgear/metar/Local.h       23 Jul 2003 09:59:39 -0000      1.2
+++ simgear/metar/Local.h       23 Nov 2003 01:38:09 -0000
@@ -1107,7 +1107,7 @@
 char *rptfmt(char *);
 char *rptfmti(char *, unsigned short int);

-#ifndef __FreeBSD__ // strnstr is already defined on FreeBSD
+#if !defined(__FreeBSD__) && !defined(__APPLE__) // strnstr is already defined on FreeBSD / Darwin
char *strnstr(char *, char *, size_t);
#endif



===================================================================
RCS file: /var/cvs/SimGear-0.3/SimGear/simgear/scene/material/matlib.cxx,v
retrieving revision 1.8
diff -u -r1.8 matlib.cxx
--- simgear/scene/material/matlib.cxx 24 Sep 2003 17:19:23 -0000 1.8
+++ simgear/scene/material/matlib.cxx 23 Nov 2003 01:38:11 -0000
@@ -178,7 +178,8 @@
static int gen_vasi_light_map() {
const int env_tex_res = 256;
int half_res = env_tex_res / 2;
- unsigned char env_map[env_tex_res][env_tex_res][4];
+
+ static unsigned char env_map[env_tex_res][env_tex_res][4];
GLuint tex_name;


===================================================================
RCS file: /cvsroot/plib/plib/src/ssg/ssgVtxTable.cxx,v
retrieving revision 1.31
diff -u -r1.31 ssgVtxTable.cxx
--- src/ssg/ssgVtxTable.cxx     10 Nov 2002 17:12:13 -0000      1.31
+++ src/ssg/ssgVtxTable.cxx     23 Nov 2003 01:48:15 -0000
@@ -502,32 +502,41 @@
   if ( num_colours == 1 ) glColor4fv  ( colours -> get(0) ) ;
   if ( num_normals == 1 ) glNormal3fv ( normals -> get(0) ) ;

-  glPushClientAttrib ( GL_CLIENT_VERTEX_ARRAY_BIT ) ;
-
   if ( num_colours > 1 )
   {
     glEnableClientState ( GL_COLOR_ARRAY ) ;
     glColorPointer ( 4, GL_FLOAT, 0, colours->get(0) ) ;
   }
+  else
+  {
+    glDisableClientState ( GL_COLOR_ARRAY ) ;
+  }

   if ( num_normals > 1 )
   {
     glEnableClientState ( GL_NORMAL_ARRAY ) ;
     glNormalPointer ( GL_FLOAT, 0, normals->get(0) ) ;
   }
+  else
+  {
+    glDisableClientState ( GL_NORMAL_ARRAY ) ;
+  }

   if ( num_texcoords > 1 )
   {
     glEnableClientState ( GL_TEXTURE_COORD_ARRAY ) ;
     glTexCoordPointer ( 2, GL_FLOAT, 0, texcoords->get(0) ) ;
   }
+  else
+  {
+    glDisableClientState ( GL_TEXTURE_COORD_ARRAY ) ;
+  }

   glEnableClientState ( GL_VERTEX_ARRAY ) ;
+
   glVertexPointer ( 3, GL_FLOAT, 0, vertices->get(0) ) ;

   glDrawArrays ( gltype, 0, num_vertices ) ;
-
-  glPopClientAttrib () ;
 }


_______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to