- fixed freetype-gl on windows compiler

- deprecated ancient opengl extension code and replaced it with glew
- testing new font renderer on windows (still in progress need to fix newlines)
(now need to check the Linux build and possibly make adjustments)
This commit is contained in:
Mark Vejvoda
2011-11-18 08:28:42 +00:00
parent 0e9b4851fd
commit d0acde5d88
18 changed files with 111 additions and 35 deletions

View File

@@ -41,8 +41,11 @@
#include <windows.h>
#endif
//#include "gl.h"
#include <GL/glew.h>
//#include <GL/gl.h>
#include <GL/glu.h>
//#include <GL/glu.h>
//#include <glprocs.h>
#include <string.h>

View File

@@ -35,6 +35,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <GL/glew.h>
//#include "gl.h"
#else
#include <GL/glu.h>

View File

@@ -36,7 +36,21 @@
#include <stdio.h>
#include "vertex-buffer.h"
#ifdef _WIN32
char * strndup(const char *old, size_t sz)
{
size_t len = strnlen (old, sz);
char *t = malloc(len + 1);
if (t != NULL) {
memcpy (t, old, len);
t[len] = '\0';
}
return t;
}
#endif
// ----------------------------------------------------------------------------
VertexBuffer *

View File

@@ -25,6 +25,8 @@
using namespace std;
// Define FBO's (Frame Buffer Objects) for win32
/*
#ifdef WIN32
#define GL_FRAMEBUFFER_EXT 0x8D40
@@ -63,6 +65,7 @@ PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
#endif
*/
namespace Shared { namespace Graphics { namespace Gl {

View File

@@ -20,8 +20,11 @@
#include <windows.h>
#endif // _WIN32
#include <GL/gl.h>
#include <GL/glu.h>
//#include "gl.h"
#include <GL/glew.h>
//#include <GL/gl.h>
//#include <GL/glu.h>
#include <iostream>
#include "GlErrors.h"

View File

@@ -26,7 +26,7 @@
#include <iterator>
#include <algorithm>
#include "Texture.h"
#include "md5Texture.h"
#include "ArbProgram.h"
#include "ShaderManager.h"
#include "Md5Model.h"

View File

@@ -25,7 +25,7 @@
#include <stdexcept>
#include "GlErrors.h"
#include "Texture.h"
#include "md5Texture.h"
#include "Image.h"
namespace Shared { namespace Graphics { namespace md5 {
@@ -219,8 +219,8 @@ Texture2D::create (const Image *img, TextureFlags flags)
mipWidth, mipHeight, 0, mipSize,
img->pixels () + offset);
mipWidth = std::max (mipWidth >> 1, 1);
mipHeight = std::max (mipHeight >> 1, 1);
mipWidth = max (mipWidth >> 1, 1);
mipHeight = max (mipHeight >> 1, 1);
offset += mipSize;
}
@@ -492,8 +492,8 @@ TextureCubeMap::create (const vector<ImagePtr> &faces, TextureFlags flags)
mipWidth, mipHeight, 0, mipSize,
img->pixels () + offset);
mipWidth = std::max (mipWidth >> 1, 1);
mipHeight = std::max (mipHeight >> 1, 1);
mipWidth = max (mipWidth >> 1, 1);
mipHeight = max (mipHeight >> 1, 1);
offset += mipSize;
}

View File

@@ -161,6 +161,14 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool
SDL_WM_GrabInput(SDL_GRAB_OFF);
}
GLuint err = glewInit();
if (GLEW_OK != err) {
fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
//return 1;
throw std::runtime_error((char *)glewGetErrorString(err));
}
}
void PlatformContextGl::end() {