comparison src/video/SDL_renderer_gl.c @ 1952:420716272158

Implemented X11 OpenGL support. Added support for the SDL_VIDEO_OPENGL environment variable.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 28 Jul 2006 08:43:17 +0000
parents 861bc36f0ab3
children a788656ca29a
comparison
equal deleted inserted replaced
1951:7177581dc9fa 1952:420716272158
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 #if SDL_VIDEO_OPENGL 24 #if SDL_VIDEO_RENDER_OGL
25 25
26 #include "SDL_video.h" 26 #include "SDL_video.h"
27 #include "SDL_opengl.h" 27 #include "SDL_opengl.h"
28 #include "SDL_sysvideo.h" 28 #include "SDL_sysvideo.h"
29 #include "SDL_pixels_c.h" 29 #include "SDL_pixels_c.h"
195 SDL_Renderer * 195 SDL_Renderer *
196 GL_CreateRenderer(SDL_Window * window, Uint32 flags) 196 GL_CreateRenderer(SDL_Window * window, Uint32 flags)
197 { 197 {
198 SDL_Renderer *renderer; 198 SDL_Renderer *renderer;
199 GL_RenderData *data; 199 GL_RenderData *data;
200 GLint value;
200 201
201 if (!(window->flags & SDL_WINDOW_OPENGL)) { 202 if (!(window->flags & SDL_WINDOW_OPENGL)) {
202 if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) { 203 if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) {
203 return NULL; 204 return NULL;
204 } 205 }
259 } 260 }
260 if (SDL_GL_GetSwapInterval() > 0) { 261 if (SDL_GL_GetSwapInterval() > 0) {
261 renderer->info.flags |= SDL_Renderer_PresentVSync; 262 renderer->info.flags |= SDL_Renderer_PresentVSync;
262 } 263 }
263 264
264 data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, 265 data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
265 &renderer->info.max_texture_width); 266 renderer->info.max_texture_width = value;
266 data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, 267 data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
267 &renderer->info.max_texture_height); 268 renderer->info.max_texture_height = value;
268 269
269 if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") 270 if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle")
270 || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) { 271 || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
271 data->GL_ARB_texture_rectangle_supported = SDL_TRUE; 272 data->GL_ARB_texture_rectangle_supported = SDL_TRUE;
272 } 273 }
704 SDL_free(data); 705 SDL_free(data);
705 } 706 }
706 SDL_free(renderer); 707 SDL_free(renderer);
707 } 708 }
708 709
709 #endif /* SDL_VIDEO_OPENGL */ 710 #endif /* SDL_VIDEO_RENDER_OGL */
710 711
711 /* vi: set ts=4 sw=4 expandtab: */ 712 /* vi: set ts=4 sw=4 expandtab: */