comparison src/video/quartz/SDL_QuartzGL.m @ 1656:96c2f89cc7e1 SDL-1.3

SDL-trunk-1.3-merge-1
author Sam Lantinga <slouken@libsdl.org>
date Thu, 27 Apr 2006 09:09:48 +0000
parents 376665398b25
children 782fd950bd46
comparison
equal deleted inserted replaced
1655:59227394023d 1656:96c2f89cc7e1
110 attr[i++] = NSOpenGLPFASamples; 110 attr[i++] = NSOpenGLPFASamples;
111 attr[i++] = this->gl_config.multisamplesamples; 111 attr[i++] = this->gl_config.multisamplesamples;
112 attr[i++] = NSOpenGLPFANoRecovery; 112 attr[i++] = NSOpenGLPFANoRecovery;
113 } 113 }
114 114
115 if ( this->gl_config.accelerated > 0 ) {
116 attr[i++] = NSOpenGLPFAAccelerated;
117 }
118
115 attr[i++] = NSOpenGLPFAScreenMask; 119 attr[i++] = NSOpenGLPFAScreenMask;
116 attr[i++] = CGDisplayIDToOpenGLDisplayMask (display_id); 120 attr[i++] = CGDisplayIDToOpenGLDisplayMask (display_id);
117 attr[i] = 0; 121 attr[i] = 0;
118 122
119 fmt = [ [ NSOpenGLPixelFormat alloc ] initWithAttributes:attr ]; 123 fmt = [ [ NSOpenGLPixelFormat alloc ] initWithAttributes:attr ];
128 [ fmt release ]; 132 [ fmt release ];
129 133
130 if (gl_context == nil) { 134 if (gl_context == nil) {
131 SDL_SetError ("Failed creating OpenGL context"); 135 SDL_SetError ("Failed creating OpenGL context");
132 return 0; 136 return 0;
137 }
138
139 /* Synchronize QZ_GL_SwapBuffers() to vertical retrace.
140 * (Apple's documentation is not completely clear about what this setting
141 * exactly does, IMHO - for a detailed explanation see
142 * http://lists.apple.com/archives/mac-opengl/2006/Jan/msg00080.html )
143 */
144 if ( this->gl_config.swap_control >= 0 ) {
145 long value;
146 value = this->gl_config.swap_control;
147 [ gl_context setValues: &value forParameter: NSOpenGLCPSwapInterval ];
133 } 148 }
134 149
135 /* 150 /*
136 * Wisdom from Apple engineer in reference to UT2003's OpenGL performance: 151 * Wisdom from Apple engineer in reference to UT2003's OpenGL performance:
137 * "You are blowing a couple of the internal OpenGL function caches. This 152 * "You are blowing a couple of the internal OpenGL function caches. This
229 glGetIntegerv (GL_GREEN_BITS,&component); bits += component; 244 glGetIntegerv (GL_GREEN_BITS,&component); bits += component;
230 glGetIntegerv (GL_BLUE_BITS, &component); bits += component; 245 glGetIntegerv (GL_BLUE_BITS, &component); bits += component;
231 glGetIntegerv (GL_ALPHA_BITS, &component); bits += component; 246 glGetIntegerv (GL_ALPHA_BITS, &component); bits += component;
232 247
233 *value = bits; 248 *value = bits;
249 return 0;
234 } 250 }
235 return 0; 251 case SDL_GL_ACCELERATED_VISUAL:
252 {
253 long val;
254 /* FIXME: How do we get this information here?
255 [fmt getValues: &val forAttribute: NSOpenGLPFAAccelerated attr forVirtualScreen: 0];
256 */
257 val = (this->gl_config.accelerated != 0);;
258 *value = val;
259 return 0;
260 }
261 case SDL_GL_SWAP_CONTROL:
262 {
263 long val;
264 [ gl_context getValues: &val forParameter: NSOpenGLCPSwapInterval ];
265 *value = val;
266 return 0;
267 }
236 } 268 }
237 269
238 glGetIntegerv (attr, (GLint *)value); 270 glGetIntegerv (attr, (GLint *)value);
239 return 0; 271 return 0;
240 } 272 }