Nvidia workarounds
- partially working workaround for nvidia bug on Os X 10.4.3 - brought back the raster ops hack for GT6800 with proper driver version check so that text works both on Os X 10.4.3 and older systems. this last patch was given by Kent Miller from Apple
This commit is contained in:
@@ -59,6 +59,86 @@
|
||||
#include "BMF_BitmapFont.h"
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <stdio.h>
|
||||
|
||||
static int needs_nvidia_rasterpos_workaround(void)
|
||||
{
|
||||
static int well_is_it= -1;
|
||||
|
||||
if (well_is_it==-1)
|
||||
{
|
||||
well_is_it= (strncmp((char *)glGetString(GL_RENDERER), "NVIDIA GeForce 6800", 18) == 0);
|
||||
if ( well_is_it != 0)
|
||||
{
|
||||
const GLubyte* vers = glGetString(GL_VERSION);
|
||||
const GLubyte* v = vers;
|
||||
int major = 0, minor = 0, sub = 0;
|
||||
|
||||
//advance to the '-'
|
||||
while ((*v != 0) && (*v!='-'))
|
||||
v++;
|
||||
|
||||
if (*v == '-')
|
||||
{
|
||||
int i = 0;
|
||||
v++;
|
||||
|
||||
while ((v[i] <= '9') && (v[i] >= '0'))
|
||||
{
|
||||
major *=10;
|
||||
major += v[i]-'0';
|
||||
i++;
|
||||
}
|
||||
|
||||
if (v[i] == '.')
|
||||
{
|
||||
i++;
|
||||
while ((v[i] <= '9') && (v[i] >= '0'))
|
||||
{
|
||||
minor *=10;
|
||||
minor += v[i]-'0';
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
major = -1;
|
||||
|
||||
if (v[i] == '.')
|
||||
{
|
||||
i++;
|
||||
while ((v[i] <= '9') && (v[i] >= '0'))
|
||||
{
|
||||
sub *=10;
|
||||
sub += v[i]-'0';
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
minor = -1;
|
||||
}
|
||||
|
||||
//OS X 10.4.3 is the first version that contained the fix for this problem
|
||||
// and the 6800's driver version in it is 1.4.16. So anything after that
|
||||
// doesn't need the workaround
|
||||
|
||||
if ( (major == -1) || (minor == -1))
|
||||
//If anything went wrong don't do the workaround
|
||||
//
|
||||
well_is_it = 0;
|
||||
else if ( (major <= 1) && (minor <= 4) && (sub < 16))
|
||||
well_is_it = 1;
|
||||
else
|
||||
well_is_it = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return well_is_it;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
BMF_BitmapFont::BMF_BitmapFont(BMF_FontData* fontData)
|
||||
: m_fontData(fontData)
|
||||
{
|
||||
@@ -74,7 +154,19 @@ void BMF_BitmapFont::DrawString(char* str)
|
||||
GLint alignment;
|
||||
unsigned char c;
|
||||
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
|
||||
#ifdef __APPLE__
|
||||
GLint vp[4]; // hack stuff
|
||||
GLubyte nullm = 0; // hack stuff
|
||||
|
||||
if(needs_nvidia_rasterpos_workaround()) { // was is_a_really_crappy_nvidia_card()
|
||||
glGetIntegerv(GL_VIEWPORT, vp); // hack stuff
|
||||
|
||||
glBitmap(1, 1, 0, 0, -vp[0], vp[1], &nullm);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
while ( (c = (unsigned char) *str++) ) {
|
||||
|
||||
@@ -655,6 +655,7 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
|
||||
case kEventWindowActivated:
|
||||
m_windowManager->setActiveWindow(window);
|
||||
window->loadCursor(window->getCursorVisibility(), window->getCursorShape());
|
||||
window->updateDrawingContext();
|
||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window) );
|
||||
break;
|
||||
case kEventWindowDeactivated:
|
||||
@@ -663,6 +664,7 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
|
||||
break;
|
||||
case kEventWindowUpdate:
|
||||
//if (getFullScreen()) GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen update event\n");
|
||||
window->updateDrawingContext();
|
||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
|
||||
break;
|
||||
case kEventWindowBoundsChanged:
|
||||
|
||||
@@ -359,6 +359,8 @@ Window *window_open(char *title, int posx, int posy, int sizex, int sizey, int s
|
||||
|
||||
win->lmouse[0]= win->size[0]/2;
|
||||
win->lmouse[1]= win->size[1]/2;
|
||||
|
||||
|
||||
} else {
|
||||
GHOST_DisposeWindow(g_system, ghostwin);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user