Mac OS X fixes from Markus Morawitz

stdint.h replacement defines for Windows and Sun from Frederic et all.
This commit is contained in:
ehofman
2005-09-05 08:17:37 +00:00
parent 68eb7031e2
commit dc09a50472
6 changed files with 29 additions and 13 deletions

View File

@@ -376,6 +376,8 @@
# define SG_GLU_H <OpenGL/glu.h>
# define SG_GLEXT_H <OpenGL/glext.h>
# define SG_GLUT_H <GLUT/glut.h>
inline int (isnan)(double r) { return !(r <= 0 || r >= 0); }
#else
# define SG_GL_H <GL/gl.h>
# define SG_GLX_H <GL/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

View File

@@ -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");

View File

@@ -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();

View File

@@ -21,13 +21,6 @@
// #include <stdio.h>
#include <math.h>
#if defined (__APPLE__)
// any C++ header file undefines isinf and isnan
// so this should be included before <iostream>
inline int (isinf)(double r) { return isinf(r); }
inline int (isnan)(double r) { return isnan(r); }
#endif
#include <plib/sg.h>
#include <plib/ssg.h>

View File

@@ -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;

View File

@@ -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;