Merge branch 'master' into EGL

Conflicts:
	readme.html
	src/win32_platform.h
	src/x11_platform.h
This commit is contained in:
Camilla Berglund
2012-12-02 16:17:59 +01:00
11 changed files with 138 additions and 8 deletions
+3
View File
@@ -835,6 +835,9 @@ static GLboolean createContext(_GLFWwindow* window,
ADD_ATTR2(NSOpenGLPFASamples, fbconfig->samples);
}
// NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB
// frambuffer, so there's no need (and no way) to request it
ADD_ATTR(0);
#undef ADD_ATTR
+6
View File
@@ -218,6 +218,12 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
extraDiff += (desired->samples - current->samples) *
(desired->samples - current->samples);
}
if (desired->sRGB)
{
if (!current->sRGB)
extraDiff++;
}
}
// Figure out if the current one is better than the best one found so far
+8
View File
@@ -190,6 +190,11 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
else
f->samples = 0;
if (_glfwLibrary.GLX.ARB_framebuffer_sRGB)
f->sRGB = getFBConfigAttrib(window, fbconfigs[i], GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
else
f->sRGB = GL_FALSE;
f->platformID = (GLFWintptr) getFBConfigAttrib(window, fbconfigs[i], GLX_FBCONFIG_ID);
(*found)++;
@@ -527,6 +532,9 @@ int _glfwInitOpenGL(void)
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
_glfwLibrary.GLX.ARB_multisample = GL_TRUE;
if (_glfwPlatformExtensionSupported("GLX_ARB_framebuffer_sRGB"))
_glfwLibrary.GLX.ARB_framebuffer_sRGB = GL_TRUE;
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context"))
{
_glfwLibrary.GLX.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
+1
View File
@@ -105,6 +105,7 @@ typedef struct _GLFWlibraryGLX
GLboolean EXT_swap_control;
GLboolean MESA_swap_control;
GLboolean ARB_multisample;
GLboolean ARB_framebuffer_sRGB;
GLboolean ARB_create_context;
GLboolean ARB_create_context_profile;
GLboolean ARB_create_context_robustness;
+3
View File
@@ -100,6 +100,7 @@ struct _GLFWhints
GLboolean resizable;
GLboolean visible;
int samples;
GLboolean sRGB;
int clientAPI;
int glMajor;
int glMinor;
@@ -160,6 +161,7 @@ struct _GLFWfbconfig
int auxBuffers;
GLboolean stereo;
int samples;
GLboolean sRGB;
GLFWintptr platformID;
};
@@ -199,6 +201,7 @@ struct _GLFWwindow
int glRobustness;
PFNGLGETSTRINGIPROC GetStringi;
GLFWwindowposfun windowPosCallback;
GLFWwindowsizefun windowSizeCallback;
GLFWwindowclosefun windowCloseCallback;
GLFWwindowrefreshfun windowRefreshCallback;
+12
View File
@@ -72,6 +72,7 @@ static void initWGLExtensions(_GLFWwindow* window)
// This needs to include every extension used below except for
// WGL_ARB_extensions_string and WGL_EXT_extensions_string
window->WGL.ARB_multisample = GL_FALSE;
window->WGL.ARB_framebuffer_sRGB = GL_FALSE;
window->WGL.ARB_create_context = GL_FALSE;
window->WGL.ARB_create_context_profile = GL_FALSE;
window->WGL.EXT_create_context_es2_profile = GL_FALSE;
@@ -92,6 +93,9 @@ static void initWGLExtensions(_GLFWwindow* window)
if (_glfwPlatformExtensionSupported("WGL_ARB_multisample"))
window->WGL.ARB_multisample = GL_TRUE;
if (_glfwPlatformExtensionSupported("WGL_ARB_framebuffer_sRGB"))
window->WGL.ARB_framebuffer_sRGB = GL_TRUE;
if (_glfwPlatformExtensionSupported("WGL_ARB_create_context"))
{
window->WGL.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
@@ -246,6 +250,11 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
f->samples = getPixelFormatAttrib(window, i, WGL_SAMPLES_ARB);
else
f->samples = 0;
if (window->WGL.ARB_framebuffer_sRGB)
f->sRGB = getPixelFormatAttrib(window, i, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
else
f->sRGB = GL_FALSE;
}
else
{
@@ -293,6 +302,9 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
// PFD pixel formats do not support FSAA
f->samples = 0;
// PFD pixel formats do not support sRGB
f->sRGB = GL_FALSE;
}
f->platformID = i;
+1
View File
@@ -62,6 +62,7 @@ typedef struct _GLFWcontextWGL
PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
GLboolean EXT_swap_control;
GLboolean ARB_multisample;
GLboolean ARB_framebuffer_sRGB;
GLboolean ARB_pixel_format;
GLboolean ARB_create_context;
GLboolean ARB_create_context_profile;
+28
View File
@@ -119,8 +119,14 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
{
if (window->positionX == x && window->positionY == y)
return;
window->positionX = x;
window->positionY = y;
if (window->windowPosCallback)
window->windowPosCallback(window, x, y);
}
@@ -231,6 +237,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
fbconfig.auxBuffers = Max(_glfwLibrary.hints.auxBuffers, 0);
fbconfig.stereo = _glfwLibrary.hints.stereo ? GL_TRUE : GL_FALSE;
fbconfig.samples = Max(_glfwLibrary.hints.samples, 0);
fbconfig.sRGB = _glfwLibrary.hints.sRGB ? GL_TRUE : GL_FALSE;
// Set up desired window config
wndconfig.mode = mode;
@@ -440,6 +447,9 @@ GLFWAPI void glfwWindowHint(int target, int hint)
case GLFW_FSAA_SAMPLES:
_glfwLibrary.hints.samples = hint;
break;
case GLFW_SRGB_CAPABLE:
_glfwLibrary.hints.sRGB = hint;
break;
case GLFW_CLIENT_API:
_glfwLibrary.hints.clientAPI = hint;
break;
@@ -764,6 +774,24 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow handle)
}
//========================================================================
// Set callback function for window position changes
//========================================================================
GLFWAPI void glfwSetWindowPosCallback(GLFWwindow handle, GLFWwindowposfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return;
}
window->windowPosCallback = cbfun;
}
//========================================================================
// Set callback function for window size changes
//========================================================================