src/video/x11/SDL_x11opengl.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 28 Jul 2006 08:43:17 +0000
changeset 1952 420716272158
child 1953 214880ed48c3
permissions -rw-r--r--
Implemented X11 OpenGL support.
Added support for the SDL_VIDEO_OPENGL environment variable.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 #ifndef _SDL_x11opengl_h
    25 #define _SDL_x11opengl_h
    26 
    27 #if SDL_VIDEO_OPENGL_GLX
    28 #include "SDL_opengl.h"
    29 #include <GL/glx.h>
    30 
    31 struct SDL_GLDriverData
    32 {
    33     int initialized;
    34     SDL_bool HAS_GLX_EXT_visual_rating;
    35 
    36     void *(*glXGetProcAddress) (const GLubyte * procName);
    37 
    38     XVisualInfo *(*glXChooseVisual)
    39       (Display * dpy, int screen, int *attribList);
    40 
    41       GLXContext(*glXCreateContext)
    42       (Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool direct);
    43 
    44     void (*glXDestroyContext)
    45       (Display * dpy, GLXContext ctx);
    46 
    47       Bool(*glXMakeCurrent)
    48       (Display * dpy, GLXDrawable drawable, GLXContext ctx);
    49 
    50     void (*glXSwapBuffers)
    51       (Display * dpy, GLXDrawable drawable);
    52 
    53     int (*glXGetConfig)
    54       (Display * dpy, XVisualInfo * visual_info, int attrib, int *value);
    55 
    56     int (*glXSwapIntervalSGI) (int interval);
    57       GLint(*glXSwapIntervalMESA) (unsigned interval);
    58       GLint(*glXGetSwapIntervalMESA) (void);
    59 };
    60 
    61 /* OpenGL functions */
    62 extern int X11_GL_LoadLibrary(_THIS, const char *path);
    63 extern void *X11_GL_GetProcAddress(_THIS, const char *proc);
    64 extern int X11_GL_Initialize(_THIS);
    65 extern void X11_GL_Shutdown(_THIS);
    66 extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen);
    67 extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window);
    68 extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window,
    69                               SDL_GLContext context);
    70 extern int X11_GL_SetSwapInterval(_THIS, int interval);
    71 extern int X11_GL_GetSwapInterval(_THIS);
    72 extern void X11_GL_SwapWindow(_THIS, SDL_Window * window);
    73 extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context);
    74 
    75 #endif /* SDL_VIDEO_OPENGL_GLX */
    76 
    77 #endif /* _SDL_x11opengl_h */
    78 
    79 /* vi: set ts=4 sw=4 expandtab: */