From: ehofman Date: Mon, 5 Sep 2005 08:17:37 +0000 (+0000) Subject: Mac OS X fixes from Markus Morawitz X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dc09a50472890ac706d3c76d8af34cc3682ada0c;p=simgear.git Mac OS X fixes from Markus Morawitz stdint.h replacement defines for Windows and Sun from Frederic et all. --- diff --git a/simgear/compiler.h b/simgear/compiler.h index 3af548df..c2a5b28e 100644 --- a/simgear/compiler.h +++ b/simgear/compiler.h @@ -376,6 +376,8 @@ # define SG_GLU_H # define SG_GLEXT_H # define SG_GLUT_H + +inline int (isnan)(double r) { return !(r <= 0 || r >= 0); } #else # define SG_GL_H # define SG_GLX_H @@ -465,4 +467,13 @@ inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const) #endif // SG_INCOMPLETE_FUNCTIONAL + +// stdint.h defines +#if defined( _MSC_VER ) || defined(__MINGW32__) || defined(sun) +typedef signed short int16_t; +typedef signed int int32_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#endif + #endif // _SG_COMPILER_H diff --git a/simgear/scene/model/shadowvolume.cxx b/simgear/scene/model/shadowvolume.cxx index 9e0a1294..89eef9ce 100644 --- a/simgear/scene/model/shadowvolume.cxx +++ b/simgear/scene/model/shadowvolume.cxx @@ -871,7 +871,7 @@ SGShadowVolume::~SGShadowVolume() { void SGShadowVolume::init(SGPropertyNode *sim_rendering_options) { shadows_enabled = true; sim_rendering = sim_rendering_options; - int stencilBits = 0, alphaBits = 0; + GLint stencilBits = 0, alphaBits = 0; glGetIntegerv( GL_STENCIL_BITS, &stencilBits ); glGetIntegerv( GL_ALPHA_BITS, &alphaBits ); bool hasSubtractiveBlend = SGIsOpenGLExtensionSupported("GL_EXT_blend_subtract"); diff --git a/simgear/scene/sky/bbcache.cxx b/simgear/scene/sky/bbcache.cxx index 55a2562d..b56df6f1 100644 --- a/simgear/scene/sky/bbcache.cxx +++ b/simgear/scene/sky/bbcache.cxx @@ -109,7 +109,7 @@ SGBbCache::~SGBbCache(void) { void SGBbCache::init(int cacheCount) { - int colorBits = 0; + GLint colorBits = 0; glGetIntegerv( GL_BLUE_BITS, &colorBits ); rt = new RenderTexture(); diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx index 64034766..f4b3de25 100644 --- a/simgear/scene/sky/cloud.cxx +++ b/simgear/scene/sky/cloud.cxx @@ -21,13 +21,6 @@ // #include #include -#if defined (__APPLE__) -// any C++ header file undefines isinf and isnan -// so this should be included before -inline int (isinf)(double r) { return isinf(r); } -inline int (isnan)(double r) { return isnan(r); } -#endif - #include #include diff --git a/simgear/scene/sky/cloudfield.cxx b/simgear/scene/sky/cloudfield.cxx index d9608de6..04b32db7 100644 --- a/simgear/scene/sky/cloudfield.cxx +++ b/simgear/scene/sky/cloudfield.cxx @@ -42,6 +42,18 @@ SG_USING_STD(vector); #include "newcloud.hxx" #include "cloudfield.hxx" +#if defined(__MINGW32__) +#define isnan(x) _isnan(x) +#endif + +#if defined (__FreeBSD__) +# if __FreeBSD_version < 500000 + extern "C" { + inline int isnan(double r) { return !(r <= 0 || r >= 0); } + } +# endif +#endif + extern SGSky *thesky; static list_of_culledCloud inViewClouds; diff --git a/simgear/screen/shader.cpp b/simgear/screen/shader.cpp index 6276051a..98284f93 100644 --- a/simgear/screen/shader.cpp +++ b/simgear/screen/shader.cpp @@ -218,7 +218,7 @@ Shader::Shader(const char *name,const char *vertex,const char *fragment) { glGenProgramsPtr(1,&vertex_id); glBindProgramPtr(GL_VERTEX_PROGRAM_ARB,vertex_id); glProgramStringPtr(GL_VERTEX_PROGRAM_ARB,GL_PROGRAM_FORMAT_ASCII_ARB,(GLsizei)strlen(vertex_src),vertex_src); - int pos = -1; + GLint pos = -1; glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB,&pos); if(pos != -1) { SG_LOG(SG_GL, SG_ALERT, "Shader::Shader(): vertex program error in " << name << " file\n" << get_error(vertex_src,pos)); @@ -291,7 +291,7 @@ Shader::Shader(const char *name,const char *vertex,const char *fragment) { glGenProgramsPtr(1,&fragment_id); glBindProgramPtr(GL_FRAGMENT_PROGRAM_ARB,fragment_id); glProgramStringPtr(GL_FRAGMENT_PROGRAM_ARB,GL_PROGRAM_FORMAT_ASCII_ARB,(GLsizei)strlen(fragment_src),fragment_src); - int pos = -1; + GLint pos = -1; glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB,&pos); if(pos != -1) { SG_LOG(SG_GL, SG_ALERT, "Shader::Shader(): fragment program error in " << name << " file\n" << get_error(fragment_src,pos)); @@ -305,7 +305,7 @@ Shader::Shader(const char *name,const char *vertex,const char *fragment) { glGenProgramsNVPtr(1,&fragment_id); glBindProgramNVPtr(GL_FRAGMENT_PROGRAM_NV,fragment_id); glLoadProgramNVPtr(GL_FRAGMENT_PROGRAM_NV,fragment_id,(GLsizei)strlen(fragment_src),(GLubyte*)fragment_src); - int pos = -1; + GLint pos = -1; glGetIntegerv(GL_PROGRAM_ERROR_POSITION_NV,&pos); if(pos != -1) { SG_LOG(SG_GL, SG_ALERT, "Shader::Shader(): fragment program error in " << name << " file\n" << get_error(fragment_src,pos)); @@ -384,7 +384,7 @@ const char *Shader::get_error(char *data,int pos) { */ const char *Shader::get_glsl_error() { - int length; + GLint length; static char error[4096]; glGetInfoLogPtr(program,sizeof(error),&length,error); return error;