src/video/wincommon/SDL_wingl.c
branchSDL-1.2
changeset 6059 a04171d6fa11
parent 6057 d0b7c45e982e
child 6137 4720145f848b
equal deleted inserted replaced
6058:6144843db128 6059:a04171d6fa11
   174 	int retval;
   174 	int retval;
   175 #if SDL_VIDEO_OPENGL
   175 #if SDL_VIDEO_OPENGL
   176 	int i;
   176 	int i;
   177 	int iAttribs[64];
   177 	int iAttribs[64];
   178 	int *iAttr;
   178 	int *iAttr;
       
   179 	int *iAccelAttr = NULL;
   179 	float fAttribs[1] = { 0 };
   180 	float fAttribs[1] = { 0 };
   180 	const GLubyte *(WINAPI *glGetStringFunc)(GLenum);
   181 	const GLubyte *(WINAPI *glGetStringFunc)(GLenum);
   181 	const char *wglext;
   182 	const char *wglext;
   182 
   183 
   183 	/* load the gl driver from a default path */
   184 	/* load the gl driver from a default path */
   230 	/* We always choose either FULL or NO accel on Windows, because of flaky
   231 	/* We always choose either FULL or NO accel on Windows, because of flaky
   231 	   drivers. If the app didn't specify, we use FULL, because that's
   232 	   drivers. If the app didn't specify, we use FULL, because that's
   232 	   probably what they wanted (and if you didn't care and got FULL, that's
   233 	   probably what they wanted (and if you didn't care and got FULL, that's
   233 	   a perfectly valid result in any case. */
   234 	   a perfectly valid result in any case. */
   234 	*iAttr++ = WGL_ACCELERATION_ARB;
   235 	*iAttr++ = WGL_ACCELERATION_ARB;
       
   236 	iAccelAttr = iAttr;
   235 	if (this->gl_config.accelerated) {
   237 	if (this->gl_config.accelerated) {
   236 		*iAttr++ = WGL_FULL_ACCELERATION_ARB;
   238 		*iAttr++ = WGL_FULL_ACCELERATION_ARB;
   237 	} else {
   239 	} else {
   238 		*iAttr++ = WGL_NO_ACCELERATION_ARB;
   240 		*iAttr++ = WGL_NO_ACCELERATION_ARB;
   239 	}
   241 	}
   299 			return(-1);
   301 			return(-1);
   300 		}
   302 		}
   301 
   303 
   302 		/* Choose and set the closest available pixel format */
   304 		/* Choose and set the closest available pixel format */
   303 		pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs);
   305 		pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs);
       
   306 		/* App said "don't care about accel" and FULL accel failed. Try NO. */
       
   307 		if ( ( !pixel_format ) && ( this->gl_config.accelerated < 0 ) ) {
       
   308 			*iAccelAttr = WGL_NO_ACCELERATION_ARB;
       
   309 			pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs);
       
   310 			*iAccelAttr = WGL_FULL_ACCELERATION_ARB;  /* if we try again. */
       
   311 		}
   304 		if ( !pixel_format ) {
   312 		if ( !pixel_format ) {
   305 			pixel_format = ChoosePixelFormat(GL_hdc, &GL_pfd);
   313 			pixel_format = ChoosePixelFormat(GL_hdc, &GL_pfd);
   306 		}
   314 		}
   307 		if ( !pixel_format ) {
   315 		if ( !pixel_format ) {
   308 			SDL_SetError("No matching GL pixel format available");
   316 			SDL_SetError("No matching GL pixel format available");