comparison src/video/SDL_video.c @ 3139:7f684f249ec9

indent
author Sam Lantinga <slouken@libsdl.org>
date Sat, 23 May 2009 22:41:08 +0000
parents 7dc982143c06
children 3df74541339b 494559cc723b
comparison
equal deleted inserted replaced
3125:d71d8ceda8b3 3139:7f684f249ec9
1494 1494
1495 /* Create a new renderer instance */ 1495 /* Create a new renderer instance */
1496 window->renderer = SDL_CurrentDisplay.render_drivers[index] 1496 window->renderer = SDL_CurrentDisplay.render_drivers[index]
1497 .CreateRenderer(window, flags); 1497 .CreateRenderer(window, flags);
1498 1498
1499 if (window->renderer==NULL) 1499 if (window->renderer == NULL) {
1500 { 1500 /* Assuming renderer set its error */
1501 /* Assuming renderer set its error */ 1501 return -1;
1502 return -1;
1503 } 1502 }
1504 1503
1505 SDL_SelectRenderer(window->id); 1504 SDL_SelectRenderer(window->id);
1506 1505
1507 return 0; 1506 return 0;
2717 int 2716 int
2718 SDL_GL_GetAttribute(SDL_GLattr attr, int *value) 2717 SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
2719 { 2718 {
2720 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES 2719 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
2721 void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params); 2720 void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
2722 GLenum (APIENTRY * glGetErrorFunc) (void); 2721 GLenum(APIENTRY * glGetErrorFunc) (void);
2723 GLenum attrib = 0; 2722 GLenum attrib = 0;
2724 GLenum error = 0; 2723 GLenum error = 0;
2725 2724
2726 glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv"); 2725 glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
2727 if (!glGetIntegervFunc) { 2726 if (!glGetIntegervFunc) {
2732 if (!glGetErrorFunc) { 2731 if (!glGetErrorFunc) {
2733 return -1; 2732 return -1;
2734 } 2733 }
2735 2734
2736 /* Clear value in any case */ 2735 /* Clear value in any case */
2737 *value=0; 2736 *value = 0;
2738 2737
2739 switch (attr) { 2738 switch (attr) {
2740 case SDL_GL_RETAINED_BACKING: 2739 case SDL_GL_RETAINED_BACKING:
2741 *value = _this->gl_config.retained_backing; 2740 *value = _this->gl_config.retained_backing;
2742 return 0; 2741 return 0;
2840 SDL_SetError("Unknown OpenGL attribute"); 2839 SDL_SetError("Unknown OpenGL attribute");
2841 return -1; 2840 return -1;
2842 } 2841 }
2843 2842
2844 glGetIntegervFunc(attrib, (GLint *) value); 2843 glGetIntegervFunc(attrib, (GLint *) value);
2845 error=glGetErrorFunc(); 2844 error = glGetErrorFunc();
2846 if (error!=GL_NO_ERROR) 2845 if (error != GL_NO_ERROR) {
2847 { 2846 switch (error) {
2848 switch (error) 2847 case GL_INVALID_ENUM:
2849 { 2848 {
2850 case GL_INVALID_ENUM: 2849 SDL_SetError("OpenGL error: GL_INVALID_ENUM");
2851 { 2850 }
2852 SDL_SetError("OpenGL error: GL_INVALID_ENUM"); 2851 break;
2853 } 2852 case GL_INVALID_VALUE:
2854 break; 2853 {
2855 case GL_INVALID_VALUE: 2854 SDL_SetError("OpenGL error: GL_INVALID_VALUE");
2856 { 2855 }
2857 SDL_SetError("OpenGL error: GL_INVALID_VALUE"); 2856 break;
2858 } 2857 default:
2859 break; 2858 {
2860 default: 2859 SDL_SetError("OpenGL error: %08X", error);
2861 { 2860 }
2862 SDL_SetError("OpenGL error: %08X", error); 2861 break;
2863 } 2862 }
2864 break; 2863 return -1;
2865 }
2866 return -1;
2867 } 2864 }
2868 return 0; 2865 return 0;
2869 #else 2866 #else
2870 SDL_Unsupported(); 2867 SDL_Unsupported();
2871 return -1; 2868 return -1;