- merging in changes from weltall for macosx

This commit is contained in:
Mark Vejvoda 2011-10-18 01:13:38 +00:00
parent fa5aea7e42
commit 5b7329594c
14 changed files with 60 additions and 37 deletions

View File

@ -65,14 +65,14 @@ INSTALL(FILES
#the SDL_LIBRARY is seen as a framework thus we need to remove the suffix... #the SDL_LIBRARY is seen as a framework thus we need to remove the suffix...
STRING(REGEX REPLACE ";.*" "" SDL_LIBRARY_DIR "${SDL_LIBRARY}") STRING(REGEX REPLACE ";.*" "" SDL_LIBRARY_DIR "${SDL_LIBRARY}")
INSTALL(DIRECTORY #INSTALL(DIRECTORY
${OGG_LIBRARY} # ${OGG_LIBRARY}
${XERCESC_LIBRARY} # ${XERCESC_LIBRARY}
${VORBIS_LIBRARY} # ${VORBIS_LIBRARY}
${SDL_LIBRARY_DIR} # ${SDL_LIBRARY_DIR}
${PNG_LIBRARY} # ${PNG_LIBRARY}
DESTINATION ../Frameworks # DESTINATION ../Frameworks
) # )
include (CPack) include (CPack)

View File

@ -1878,9 +1878,13 @@ GlCanvas::~GlCanvas() {
} }
void GlCanvas::setCurrentGLContext() { void GlCanvas::setCurrentGLContext() {
#ifndef __APPLE__
if(this->context) { if(this->context) {
this->SetCurrent(*this->context); this->SetCurrent(*this->context);
} }
#else
this->SetCurrent();
#endif
} }
// for the mousewheel // for the mousewheel

View File

@ -2635,7 +2635,7 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
VisibleQuadContainerVBOCache vboCache; VisibleQuadContainerVBOCache vboCache;
// Generate And Bind The Vertex Buffer // Generate And Bind The Vertex Buffer
glGenBuffersARB( 1, &vboCache.m_nVBOVertices ); // Get A Valid Name glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBOVertices ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOVertices ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOVertices ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, vertices, GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, vertices, GL_STATIC_DRAW_ARB );
@ -2643,7 +2643,7 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
assertGl(); assertGl();
// Generate And Bind The Texture Coordinate Buffer // Generate And Bind The Texture Coordinate Buffer
glGenBuffersARB( 1, &vboCache.m_nVBOFowTexCoords ); // Get A Valid Name glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBOFowTexCoords ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOFowTexCoords ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOFowTexCoords ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoords, GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoords, GL_STATIC_DRAW_ARB );
@ -2651,7 +2651,7 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
assertGl(); assertGl();
// Generate And Bind The Texture Coordinate Buffer // Generate And Bind The Texture Coordinate Buffer
glGenBuffersARB( 1, &vboCache.m_nVBOSurfaceTexCoords ); // Get A Valid Name glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBOSurfaceTexCoords ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOSurfaceTexCoords ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOSurfaceTexCoords ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoordsSurface, GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoordsSurface, GL_STATIC_DRAW_ARB );
@ -2659,7 +2659,7 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
assertGl(); assertGl();
// Generate And Bind The Normal Buffer // Generate And Bind The Normal Buffer
glGenBuffersARB( 1, &vboCache.m_nVBONormals ); // Get A Valid Name glGenBuffersARB( 1, (GLuint*)&vboCache.m_nVBONormals ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBONormals ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBONormals ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, normals, GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, normals, GL_STATIC_DRAW_ARB );
@ -2685,10 +2685,10 @@ void Renderer::ReleaseSurfaceVBOs() {
VisibleQuadContainerVBOCache &item = iterFind->second; VisibleQuadContainerVBOCache &item = iterFind->second;
if(item.hasBuiltVBOs == true) { if(item.hasBuiltVBOs == true) {
glDeleteBuffersARB( 1, &item.m_nVBOVertices ); // Get A Valid Name glDeleteBuffersARB( 1, (GLuint*)&item.m_nVBOVertices ); // Get A Valid Name
glDeleteBuffersARB( 1, &item.m_nVBOFowTexCoords ); // Get A Valid Name glDeleteBuffersARB( 1, (GLuint*)&item.m_nVBOFowTexCoords ); // Get A Valid Name
glDeleteBuffersARB( 1, &item.m_nVBOSurfaceTexCoords ); // Get A Valid Name glDeleteBuffersARB( 1, (GLuint*)&item.m_nVBOSurfaceTexCoords ); // Get A Valid Name
glDeleteBuffersARB( 1, &item.m_nVBONormals ); // Get A Valid Name glDeleteBuffersARB( 1, (GLuint*)&item.m_nVBONormals ); // Get A Valid Name
//glDeleteBuffersARB( 1, &item.m_nVBOIndexes ); // Get A Valid Name //glDeleteBuffersARB( 1, &item.m_nVBOIndexes ); // Get A Valid Name
} }
} }

View File

@ -1367,9 +1367,13 @@ GlCanvas::~GlCanvas() {
} }
void GlCanvas::setCurrentGLContext() { void GlCanvas::setCurrentGLContext() {
#ifndef __APPLE__
if(this->context) { if(this->context) {
this->SetCurrent(*this->context); this->SetCurrent(*this->context);
} }
#else
this->SetCurrent();
#endif
} }
void translateCoords(wxWindow *wnd, int &x, int &y) { void translateCoords(wxWindow *wnd, int &x, int &y) {

View File

@ -76,8 +76,14 @@ static DWORD charSet = DEFAULT_CHARSET;
static int charSet = 1; static int charSet = 1;
#endif #endif
#if defined(__APPLE__)
void inline createGlFontBitmaps(uint32 &base, const string &type, int size, int width, int charCount, FontMetrics &metrics) {}
void inline createGlFontOutlines(uint32 &base, const string &type, int width, float depth, int charCount, FontMetrics &metrics){}
#else
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width, int charCount, FontMetrics &metrics); void createGlFontBitmaps(uint32 &base, const string &type, int size, int width, int charCount, FontMetrics &metrics);
void createGlFontOutlines(uint32 &base, const string &type, int width, float depth, int charCount, FontMetrics &metrics); void createGlFontOutlines(uint32 &base, const string &type, int width, float depth, int charCount, FontMetrics &metrics);
#endif
const char *getPlatformExtensions(const PlatformContextGl *pcgl); const char *getPlatformExtensions(const PlatformContextGl *pcgl);
void* getGlProcAddress(const char *procName); void* getGlProcAddress(const char *procName);

View File

@ -32,7 +32,7 @@ void Font2DGl::init() {
handle= glGenLists(charCount); handle= glGenLists(charCount);
assertGl(); assertGl();
createGlFontBitmaps(handle, type, size, width, charCount, metrics); createGlFontBitmaps((Shared::Platform::uint32&)handle, type, size, width, charCount, metrics);
assertGl(); assertGl();
} }
inited= true; inited= true;
@ -60,7 +60,7 @@ void Font3DGl::init() {
if(getTextHandler() == NULL) { if(getTextHandler() == NULL) {
assertGl(); assertGl();
handle= glGenLists(charCount); handle= glGenLists(charCount);
createGlFontOutlines(handle, type, width, depth, charCount, metrics); createGlFontOutlines((Shared::Platform::uint32&)handle, type, width, depth, charCount, metrics);
assertGl(); assertGl();
} }
inited= true; inited= true;

View File

@ -234,7 +234,6 @@ void TextFTGL::Render(const char* str, const int len) {
if(len != 0) { if(len != 0) {
//printf("FTGL Render [%s] facesize = %d\n",str,ftFont->FaceSize()); //printf("FTGL Render [%s] facesize = %d\n",str,ftFont->FaceSize());
assertGl(); assertGl();
ftFont->Render(str, len); ftFont->Render(str, len);
//assertGl(); //assertGl();
GLenum error = glGetError(); GLenum error = glGetError();

View File

@ -139,31 +139,31 @@ const char *getGlPlatformExtensions() {
int getGlMaxLights() { int getGlMaxLights() {
int i; int i;
glGetIntegerv(GL_MAX_LIGHTS, &i); glGetIntegerv(GL_MAX_LIGHTS, (GLint*)&i);
return i; return i;
} }
int getGlMaxTextureSize() { int getGlMaxTextureSize() {
int i; int i;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &i); glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*)&i);
return i; return i;
} }
int getGlMaxTextureUnits() { int getGlMaxTextureUnits() {
int i; int i;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &i); glGetIntegerv(GL_MAX_TEXTURE_UNITS, (GLint*)&i);
return i; return i;
} }
int getGlModelviewMatrixStackDepth() { int getGlModelviewMatrixStackDepth() {
int i; int i;
glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &i); glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, (GLint*)&i);
return i; return i;
} }
int getGlProjectionMatrixStackDepth() { int getGlProjectionMatrixStackDepth() {
int i; int i;
glGetIntegerv(GL_MAX_PROJECTION_STACK_DEPTH, &i); glGetIntegerv(GL_MAX_PROJECTION_STACK_DEPTH, (GLint*)&i);
return i; return i;
} }

View File

@ -340,7 +340,7 @@ static std::string getSupportCompressedTextureFormatString(int format) {
static int getNumCompressedTextureFormats() { static int getNumCompressedTextureFormats() {
int numCompressedTextureFormats = 0; int numCompressedTextureFormats = 0;
glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats); glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, (GLint*)&numCompressedTextureFormats);
return numCompressedTextureFormats; return numCompressedTextureFormats;
} }
@ -349,7 +349,7 @@ static std::vector<int> getSupportCompressedTextureFormats() {
int count = getNumCompressedTextureFormats(); int count = getNumCompressedTextureFormats();
if(count > 0) { if(count > 0) {
int *formats = new int[count]; int *formats = new int[count];
glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS,&formats[0]); glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS,(GLint*)&formats[0]);
for(int i = 0; i < count; ++i) { for(int i = 0; i < count; ++i) {
result.push_back(formats[i]); result.push_back(formats[i]);

View File

@ -138,28 +138,28 @@ void Mesh::BuildVBOs() {
//printf("In [%s::%s Line: %d] setting up a VBO...\n",__FILE__,__FUNCTION__,__LINE__); //printf("In [%s::%s Line: %d] setting up a VBO...\n",__FILE__,__FUNCTION__,__LINE__);
// Generate And Bind The Vertex Buffer // Generate And Bind The Vertex Buffer
glGenBuffersARB( 1, &m_nVBOVertices ); // Get A Valid Name glGenBuffersARB( 1,(GLuint*) &m_nVBOVertices ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOVertices ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOVertices ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getVertices(), GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getVertices(), GL_STATIC_DRAW_ARB );
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
// Generate And Bind The Texture Coordinate Buffer // Generate And Bind The Texture Coordinate Buffer
glGenBuffersARB( 1, &m_nVBOTexCoords ); // Get A Valid Name glGenBuffersARB( 1, (GLuint*)&m_nVBOTexCoords ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOTexCoords ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOTexCoords ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f)*vertexCount, texCoords, GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f)*vertexCount, texCoords, GL_STATIC_DRAW_ARB );
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
// Generate And Bind The Normal Buffer // Generate And Bind The Normal Buffer
glGenBuffersARB( 1, &m_nVBONormals ); // Get A Valid Name glGenBuffersARB( 1, (GLuint*)&m_nVBONormals ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBONormals ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBONormals ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getNormals(), GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getNormals(), GL_STATIC_DRAW_ARB );
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
// Generate And Bind The Index Buffer // Generate And Bind The Index Buffer
glGenBuffersARB( 1, &m_nVBOIndexes ); // Get A Valid Name glGenBuffersARB( 1, (GLuint*)&m_nVBOIndexes ); // Get A Valid Name
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, m_nVBOIndexes ); // Bind The Buffer glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, m_nVBOIndexes ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(uint32)*indexCount, indices, GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(uint32)*indexCount, indices, GL_STATIC_DRAW_ARB );
@ -182,10 +182,10 @@ void Mesh::BuildVBOs() {
void Mesh::ReleaseVBOs() { void Mesh::ReleaseVBOs() {
if(getVBOSupported() == true) { if(getVBOSupported() == true) {
if(hasBuiltVBOs == true) { if(hasBuiltVBOs == true) {
glDeleteBuffersARB( 1, &m_nVBOVertices ); // Get A Valid Name glDeleteBuffersARB( 1, (GLuint*)&m_nVBOVertices ); // Get A Valid Name
glDeleteBuffersARB( 1, &m_nVBOTexCoords ); // Get A Valid Name glDeleteBuffersARB( 1, (GLuint*)&m_nVBOTexCoords ); // Get A Valid Name
glDeleteBuffersARB( 1, &m_nVBONormals ); // Get A Valid Name glDeleteBuffersARB( 1, (GLuint*)&m_nVBONormals ); // Get A Valid Name
glDeleteBuffersARB( 1, &m_nVBOIndexes ); // Get A Valid Name glDeleteBuffersARB( 1, (GLuint*)&m_nVBOIndexes ); // Get A Valid Name
hasBuiltVBOs = false; hasBuiltVBOs = false;
} }
} }

View File

@ -60,6 +60,10 @@
#include "utf8.h" #include "utf8.h"
#include "leak_dumper.h" #include "leak_dumper.h"
#ifdef __APPLE__
#include <mach-o/dyld.h>
#endif
using namespace Shared::Platform; using namespace Shared::Platform;
using namespace Shared::Util; using namespace Shared::Util;
using namespace std; using namespace std;

View File

@ -18,7 +18,7 @@
#include "sdl_private.h" #include "sdl_private.h"
#include "noimpl.h" #include "noimpl.h"
#include "util.h" #include "util.h"
#include "window.h" //#include "window.h"
#include <vector> #include <vector>
//#include <SDL_image.h> //#include <SDL_image.h>
#include "leak_dumper.h" #include "leak_dumper.h"

View File

@ -4,6 +4,11 @@
* copyright (c) 2005-2011 Thomas Bernard * copyright (c) 2005-2011 Thomas Bernard
* This software is subjet to the conditions detailed in the * This software is subjet to the conditions detailed in the
* provided LICENSE file. */ * provided LICENSE file. */
#if defined(__APPLE__)
#define MACOSX 1
#define _DARWIN_C_SOURCE 1
#endif
#define __EXTENSIONS__ 1 #define __EXTENSIONS__ 1
#if !defined(MACOSX) && !defined(__sun) #if !defined(MACOSX) && !defined(__sun)
#if !defined(_XOPEN_SOURCE) && !defined(__OpenBSD__) && !defined(__NetBSD__) #if !defined(_XOPEN_SOURCE) && !defined(__OpenBSD__) && !defined(__NetBSD__)

View File

@ -31,7 +31,7 @@ namespace Shared { namespace Platform {
// ====================================== // ======================================
// Global Fcs // Global Fcs
// ====================================== // ======================================
#if !defined(__APPLE__)
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width, void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
int charCount, FontMetrics &metrics) { int charCount, FontMetrics &metrics) {
@ -155,5 +155,6 @@ void createGlFontOutlines(uint32 &base, const string &type, int width,
NOIMPL; NOIMPL;
} }
#endif
}}//end namespace }}//end namespace