Some safety add-on to cope with bad OpenGL implementations.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2433 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2009-06-24 20:34:21 +00:00
parent 0fa0ac5c0f
commit a86a07567e
1 changed files with 10 additions and 4 deletions

View File

@ -74,8 +74,13 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
{
const char* t = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
const size_t len = strlen(t);
c8 *str = new c8[len+1];
size_t len = 0;
c8 *str = 0;
if (t)
{
len = strlen(t);
str = new c8[len+1];
}
c8* p = str;
for (size_t i=0; i<len; ++i)
@ -199,8 +204,9 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
#ifndef _IRR_GETPROCADDRESS_WORKAROUND_
__GLXextFuncPtr (*IRR_OGL_LOAD_EXTENSION)(const GLubyte*)=0;
#ifdef GLX_VERSION_1_4
int major,minor;
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
int major=0,minor=0;
if (glXGetCurrentDisplay())
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
if ((major>1) || (minor>3))
IRR_OGL_LOAD_EXTENSION=glXGetProcAddress;
else