Author Topic: Compiling code samples from "Pangea Software’s Ultimate Game Programming Guide"  (Read 4113 times)

hazelden

  • Guest
Hi.

When I try to compile the Chapter 14 Anaglyph Stereo Rendering sample code from the "Pangea Software’s Ultimate Game Programming Guide" book I get two errors.

The first is OpenAL/alut.h: No such file or directory
The 2nd is Expected specifier-qualifier-list before 'vector'

From what I have read after searching on Google it looks like alut was split from OpenAL and there doesn't appear to be a pre-compiled framework of freealut for Mac OS X.



Does anyone have any suggestions on how I could get this example to compile on Mac OS X 10.6 Snow Leopard?

Thanks,
Andrew Hazelden

Brian Greenstone, CEO Pangea

  • Administrator
  • Hero Member
  • *****
  • Posts: 2117
  • Karma: +282/-138
    • View Profile
That sample code was originally written for OS 10.4 and Apple changed some stuff since then.  I need to update the sample code.  If I have time later today I'll see if I can find the proper solutions to fix those issues for you.

-Brian

leonifan

  • Guest
That sample code was originally written for OS 10.4 and Apple changed some stuff since then.  I need to update the sample code.  If I have time later today I'll see if I can find the proper solutions to fix those issues for you.

-Brian

Hi Brian,

I too would greatly appreciate a fix for those issues (the vector problem also affects the earlier Maths Optimizations sample).

Thanks!

leonifan

  • Guest
Okay, looks like the vector problem is down to lack of altivec support (I am on Intel arch here).

I simply replaced the union with a struct:

typedef struct
{
   GLfloat   value[16];
//   vector float v[4];
}OGLMatrix4x4;

and commented out the functions that needed the vector form (since they were all altivec versions).

Next, this left a usage of __frsqrte() to remove, so I tried using:

_mm_store_ss( & isqrt, _mm_rsqrt_ss( _mm_load_ss( & len ) ) );  // this uses SSE extensions, instead of altivec

instead of:

isqrt = __frsqrte (len);   

This seems to work for me, but I have no doubt there is a nicer (cross platform) solution..? (And since this is my first time playing with such optimisations, it may also be a bit wrong..? ;))

Apologies if I have made any errors here... be gentle ;)