comparison src/video/x11/SDL_x11opengl.c @ 3685:64ce267332c6

Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 21 Jan 2010 06:21:52 +0000
parents 19691cebb866
children f7b03b6838cb
comparison
equal deleted inserted replaced
3684:cc564f08884f 3685:64ce267332c6
219 219
220 static void 220 static void
221 X11_GL_InitExtensions(_THIS) 221 X11_GL_InitExtensions(_THIS)
222 { 222 {
223 Display *display = ((SDL_VideoData *) _this->driverdata)->display; 223 Display *display = ((SDL_VideoData *) _this->driverdata)->display;
224 int screen = ((SDL_DisplayData *) SDL_CurrentDisplay.driverdata)->screen; 224 int screen = ((SDL_DisplayData *) SDL_CurrentDisplay->driverdata)->screen;
225 XVisualInfo *vinfo; 225 XVisualInfo *vinfo;
226 XSetWindowAttributes xattr; 226 XSetWindowAttributes xattr;
227 Window w; 227 Window w;
228 GLXContext context; 228 GLXContext context;
229 const char *(*glXQueryExtensionsStringFunc) (Display *, int); 229 const char *(*glXQueryExtensionsStringFunc) (Display *, int);
392 X11_GL_CreateContext(_THIS, SDL_Window * window) 392 X11_GL_CreateContext(_THIS, SDL_Window * window)
393 { 393 {
394 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 394 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
395 Display *display = data->videodata->display; 395 Display *display = data->videodata->display;
396 int screen = 396 int screen =
397 ((SDL_DisplayData *) SDL_GetDisplayFromWindow(window)-> 397 ((SDL_DisplayData *) window->display->driverdata)->screen;
398 driverdata)->screen;
399 XWindowAttributes xattr; 398 XWindowAttributes xattr;
400 XVisualInfo v, *vinfo; 399 XVisualInfo v, *vinfo;
401 int n; 400 int n;
402 GLXContext context = NULL; 401 GLXContext context = NULL;
403 402
404 /* We do this to create a clean separation between X and GLX errors. */ 403 /* We do this to create a clean separation between X and GLX errors. */
405 XSync(display, False); 404 XSync(display, False);
406 XGetWindowAttributes(display, data->window, &xattr); 405 XGetWindowAttributes(display, data->xwindow, &xattr);
407 v.screen = screen; 406 v.screen = screen;
408 v.visualid = XVisualIDFromVisual(xattr.visual); 407 v.visualid = XVisualIDFromVisual(xattr.visual);
409 vinfo = XGetVisualInfo(display, VisualScreenMask | VisualIDMask, &v, &n); 408 vinfo = XGetVisualInfo(display, VisualScreenMask | VisualIDMask, &v, &n);
410 if (vinfo) { 409 if (vinfo) {
411 if (_this->gl_config.major_version < 3) { 410 if (_this->gl_config.major_version < 3) {
490 int 489 int
491 X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) 490 X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
492 { 491 {
493 Display *display = ((SDL_VideoData *) _this->driverdata)->display; 492 Display *display = ((SDL_VideoData *) _this->driverdata)->display;
494 Window drawable = 493 Window drawable =
495 (window ? ((SDL_WindowData *) window->driverdata)->window : None); 494 (window ? ((SDL_WindowData *) window->driverdata)->xwindow : None);
496 GLXContext glx_context = (GLXContext) context; 495 GLXContext glx_context = (GLXContext) context;
497 int status; 496 int status;
498 497
499 status = 0; 498 status = 0;
500 if (!_this->gl_data->glXMakeCurrent(display, drawable, glx_context)) { 499 if (!_this->gl_data->glXMakeCurrent(display, drawable, glx_context)) {
558 X11_GL_SwapWindow(_THIS, SDL_Window * window) 557 X11_GL_SwapWindow(_THIS, SDL_Window * window)
559 { 558 {
560 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 559 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
561 Display *display = data->videodata->display; 560 Display *display = data->videodata->display;
562 561
563 _this->gl_data->glXSwapBuffers(display, data->window); 562 _this->gl_data->glXSwapBuffers(display, data->xwindow);
564 } 563 }
565 564
566 void 565 void
567 X11_GL_DeleteContext(_THIS, SDL_GLContext context) 566 X11_GL_DeleteContext(_THIS, SDL_GLContext context)
568 { 567 {