src/video/x11/SDL_x11gl_c.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 29 May 2006 04:04:35 +0000
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
permissions -rw-r--r--
more tweaking indent options
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@252
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@1402
    22
#include "SDL_config.h"
slouken@0
    23
slouken@1361
    24
#if SDL_VIDEO_OPENGL_GLX
slouken@0
    25
#include <GL/glx.h>
icculus@1191
    26
#include "SDL_loadso.h"
slouken@110
    27
#endif
icculus@1191
    28
slouken@1361
    29
#include "../SDL_sysvideo.h"
slouken@0
    30
slouken@1662
    31
struct SDL_PrivateGLData
slouken@1662
    32
{
slouken@1662
    33
    int gl_active;              /* to stop switching drivers while we have a valid context */
slouken@0
    34
slouken@1361
    35
#if SDL_VIDEO_OPENGL_GLX
slouken@1662
    36
    GLXContext glx_context;     /* Current GL context */
slouken@1662
    37
    XVisualInfo *glx_visualinfo;        /* XVisualInfo* returned by glXChooseVisual */
slouken@0
    38
slouken@1662
    39
    void *(*glXGetProcAddress) (const GLubyte * procName);
slouken@0
    40
slouken@1662
    41
    XVisualInfo *(*glXChooseVisual)
slouken@1662
    42
      (Display * dpy, int screen, int *attribList);
slouken@0
    43
slouken@1668
    44
      GLXContext(*glXCreateContext)
slouken@1662
    45
      (Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool direct);
slouken@0
    46
slouken@1662
    47
    void (*glXDestroyContext) (Display * dpy, GLXContext ctx);
slouken@0
    48
slouken@1668
    49
      Bool(*glXMakeCurrent)
slouken@1662
    50
      (Display * dpy, GLXDrawable drawable, GLXContext ctx);
slouken@0
    51
slouken@1662
    52
    void (*glXSwapBuffers) (Display * dpy, GLXDrawable drawable);
slouken@0
    53
slouken@0
    54
    int (*glXGetConfig)
slouken@1662
    55
      (Display * dpy, XVisualInfo * visual_info, int attrib, int *value);
slouken@0
    56
slouken@1662
    57
    const char *(*glXQueryExtensionsString) (Display * dpy, int screen);
slouken@638
    58
slouken@1662
    59
    int (*glXSwapIntervalSGI) (int interval);
slouken@1668
    60
      GLint(*glXSwapIntervalMESA) (unsigned interval);
slouken@1668
    61
      GLint(*glXGetSwapIntervalMESA) (void);
slouken@1656
    62
slouken@1662
    63
#endif                          /* SDL_VIDEO_OPENGL_GLX */
slouken@0
    64
};
slouken@0
    65
slouken@0
    66
/* Old variable names */
slouken@0
    67
#define gl_active		(this->gl_data->gl_active)
slouken@0
    68
#define glx_context		(this->gl_data->glx_context)
slouken@0
    69
#define glx_visualinfo		(this->gl_data->glx_visualinfo)
slouken@0
    70
slouken@0
    71
/* OpenGL functions */
slouken@1668
    72
extern XVisualInfo *X11_GL_GetVisual(_THIS);
slouken@1668
    73
extern int X11_GL_CreateWindow(_THIS, int w, int h);
slouken@1668
    74
extern int X11_GL_CreateContext(_THIS);
slouken@1668
    75
extern void X11_GL_Shutdown(_THIS);
slouken@1361
    76
#if SDL_VIDEO_OPENGL_GLX
slouken@1668
    77
extern int X11_GL_MakeCurrent(_THIS);
slouken@1668
    78
extern int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
slouken@1668
    79
extern void X11_GL_SwapBuffers(_THIS);
slouken@1668
    80
extern int X11_GL_LoadLibrary(_THIS, const char *path);
slouken@1668
    81
extern void *X11_GL_GetProcAddress(_THIS, const char *proc);
slouken@0
    82
#endif
slouken@1668
    83
extern void X11_GL_UnloadLibrary(_THIS);
slouken@1662
    84
/* vi: set ts=4 sw=4 expandtab: */