From 1e64dcd32a76e79b5ef7201a3eeedd212007966f Mon Sep 17 00:00:00 2001 From: skattyadz Date: Fri, 1 Jul 2011 14:27:53 +0100 Subject: [PATCH] Fix OpenGL bad access error on display link thread --- MacLight/OpenGLScreenReader.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MacLight/OpenGLScreenReader.m b/MacLight/OpenGLScreenReader.m index 8c5d046..8a2133e 100644 --- a/MacLight/OpenGLScreenReader.m +++ b/MacLight/OpenGLScreenReader.m @@ -81,7 +81,9 @@ - (NSColor *)readFullScreenToBuffer // Use this routine if you want to read only a portion of the screen pixels - (NSColor *)readPartialScreenToBuffer: (size_t) width bufferHeight:(size_t) height bufferBaseAddress: (void *)baseAddress { - + // Set our context as the current OpenGL context + [mGLContext makeCurrentContext]; + // select front buffer as our source for pixel data glReadBuffer(GL_FRONT);